diff options
author | Profpatsch <mail@profpatsch.de> | 2016-04-27 21:22:17 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2016-04-27 21:42:54 +0200 |
commit | 31809189d5126979e51b4fb4cf0fa7a35a401e53 (patch) | |
tree | 3ccec79437feead6208dd2535c7a36bac5aab2e1 | |
parent | c2589e43cc3afe0331a8d6bdf25b8ebba96307e5 (diff) |
lib/call-machine: add installer image
Factor out the common iso code and use the minimal installer module to create a vuizvui installer for the current config. Add vuizvui to the NIX_PATH in the resulting system.
-rw-r--r-- | lib/call-machine.nix | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/call-machine.nix b/lib/call-machine.nix index 2030d3e6..79829995 100644 --- a/lib/call-machine.nix +++ b/lib/call-machine.nix @@ -8,8 +8,26 @@ let modules = [ path ] ++ import ../modules/module-list.nix; }; - iso = let - isoModule = "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix"; + iso = mkIso "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix" ( + { lib, ... }: let + name = eval.config.networking.hostName; + upperName = lib.toUpper name; + in rec { + isoImage.isoName = "${name}.iso"; + isoImage.volumeID = builtins.substring 0 11 "${upperName}_LIVE"; + isoImage.makeEfiBootable = true; + isoImage.makeUsbBootable = true; + isoImage.appendToMenuLabel = " \"${name}\" Live System"; + } + ); + + installerIso = mkIso "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" { + environment.sessionVariables = { + NIX_PATH = [ "vuizvui=${../.}" ]; + }; + }; + + mkIso = isoModule: extraConfig: let wrapIso = { config, pkgs, lib, ... }@attrs: let isoEval = (import isoModule attrs); isoEvalcfg = isoEval.config or {}; @@ -17,7 +35,7 @@ let fscfg = isoEvalcfg.fileSystems or {}; in { options = isoEval.options or {}; - imports = isoEval.imports or []; + imports = isoEval.imports or [ extraConfig ]; config = isoEvalcfg // { boot = bootcfg // lib.optionalAttrs (bootcfg ? loader) { loader = lib.mkForce bootcfg.loader; @@ -33,21 +51,7 @@ let }; in import "${nixpkgs}/nixos/lib/eval-config.nix" { inherit system; - modules = [ - config wrapIso - ( - { lib, ... }: let - name = eval.config.networking.hostName; - upperName = lib.toUpper name; - in rec { - isoImage.isoName = "${name}.iso"; - isoImage.volumeID = builtins.substring 0 11 "${upperName}_LIVE"; - isoImage.makeEfiBootable = true; - isoImage.makeUsbBootable = true; - isoImage.appendToMenuLabel = " \"${name}\" Live System"; - } - ) - ]; + modules = [ config wrapIso ]; }; config = { @@ -61,5 +65,5 @@ let in { build = eval.config.system.build.toplevel; - inherit config eval iso vm; + inherit config eval iso installerIso vm; } |