diff options
author | aszlig <aszlig@redmoonstudios.org> | 2015-12-15 04:30:10 +0100 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2015-12-15 04:30:10 +0100 |
commit | 8c1b7661ae7801233df2ef5cacb07c7382d74fdd (patch) | |
tree | c69e6fddd776b5ce0c92f870437637de82e62191 | |
parent | 2c5b52769214bfb36bdaf5957e32b667f7d87b65 (diff) |
lib/call-machine: Clean up expression
This gets rid of the use attribute, which is now called "config". We had the "config" attribute before but it was kinda pointless, because it was just the import of the path and nothing else. So the config attribute now is the machine configuration with all of the vuizvui modules imported as well. The "build" attribute is now called "eval", which is more appropriate, because it's the evaluation of the configuration and not the finished system build. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r-- | lib/call-machine.nix | 38 | ||||
-rw-r--r-- | machines/default.nix | 22 | ||||
-rw-r--r-- | release.nix | 14 |
3 files changed, 39 insertions, 35 deletions
diff --git a/lib/call-machine.nix b/lib/call-machine.nix index 3d524439..6061113f 100644 --- a/lib/call-machine.nix +++ b/lib/call-machine.nix @@ -1,14 +1,13 @@ -system: path: +path: { system ? builtins.currentSystem }: let nixpkgs = import ../nixpkgs-path.nix; -in rec { - config = import path; - build = import "${nixpkgs}/nixos/lib/eval-config.nix" { + eval = import "${nixpkgs}/nixos/lib/eval-config.nix" { inherit system; - modules = [ config ] ++ import ../modules/module-list.nix; + modules = [ path ] ++ import ../modules/module-list.nix; }; + iso = let isoModule = "${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix"; patchedModule = (import nixpkgs {}).runCommand "iso-image.nix" {} '' @@ -17,14 +16,14 @@ in rec { "${isoModule}" > "$out" ''; wrapIso = { config, pkgs, lib, ... }@attrs: let - eval = (import patchedModule attrs); - evalcfg = eval.config or {}; - bootcfg = evalcfg.boot or {}; - fscfg = evalcfg.fileSystems or {}; + patchedEval = (import patchedModule attrs); + patchedEvalcfg = eval.config or {}; + bootcfg = patchedEvalcfg.boot or {}; + fscfg = patchedEvalcfg.fileSystems or {}; in { - options = eval.options or {}; - imports = eval.imports or []; - config = evalcfg // { + options = patchedEval.options or {}; + imports = patchedEval.imports or []; + config = patchedEvalcfg // { boot = bootcfg // lib.optionalAttrs (bootcfg ? loader) { loader = lib.mkForce bootcfg.loader; }; @@ -40,10 +39,10 @@ in rec { in import "${nixpkgs}/nixos/lib/eval-config.nix" { inherit system; modules = [ - use wrapIso + config wrapIso ( { lib, ... }: let - name = build.config.networking.hostName; + name = eval.config.networking.hostName; upperName = lib.toUpper name; in rec { isoImage.isoName = "${name}.iso"; @@ -55,11 +54,16 @@ in rec { ) ]; }; - use = { - imports = [ config ] ++ import ../modules/module-list.nix; + + config = { + imports = [ path ] ++ import ../modules/module-list.nix; }; + vm = (import "${nixpkgs}/nixos" { inherit system; - configuration = use; + configuration = config; }).vm; + +in { + inherit config eval iso vm; } diff --git a/machines/default.nix b/machines/default.nix index 9c2911dd..9fdd7190 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -1,26 +1,26 @@ { system ? builtins.currentSystem, ... }: let - callMachine = import ../lib/call-machine.nix system; + callMachine = import ../lib/call-machine.nix; in { aszlig = { - dnyarri = callMachine ./aszlig/dnyarri.nix; - mmrnmhrm = callMachine ./aszlig/mmrnmhrm.nix; - arilou = callMachine ./aszlig/arilou.nix; - kzerza = callMachine ./aszlig/kzerza.nix; - tishtushi = callMachine ./aszlig/tishtushi.nix; + dnyarri = callMachine ./aszlig/dnyarri.nix {}; + mmrnmhrm = callMachine ./aszlig/mmrnmhrm.nix {}; + arilou = callMachine ./aszlig/arilou.nix {}; + kzerza = callMachine ./aszlig/kzerza.nix {}; + tishtushi = callMachine ./aszlig/tishtushi.nix {}; managed = { - notsure = callMachine ./aszlig/managed/notsure.nix; + notsure = callMachine ./aszlig/managed/notsure.nix {}; }; }; labnet = { - heinrich = callMachine ./labnet/heinrich.nix; - labtop = callMachine ./labnet/labtop.nix; + heinrich = callMachine ./labnet/heinrich.nix {}; + labtop = callMachine ./labnet/labtop.nix {}; }; profpatsch = { - katara = callMachine ./profpatsch/katara.nix; + katara = callMachine ./profpatsch/katara.nix {}; }; misc = { - mailserver = callMachine ./misc/mailserver.nix; + mailserver = callMachine ./misc/mailserver.nix {}; }; } diff --git a/release.nix b/release.nix index b023ef6e..04bc5218 100644 --- a/release.nix +++ b/release.nix @@ -48,8 +48,8 @@ let in with pkgsUpstream.lib; with builtins; { - machines = mapAttrsRecursiveCond (m: !(m ? build)) (path: attrs: - attrs.build.config.system.build.toplevel + machines = mapAttrsRecursiveCond (m: !(m ? eval)) (path: attrs: + attrs.eval.config.system.build.toplevel ) allMachines; isoImages = let @@ -68,9 +68,9 @@ in with pkgsUpstream.lib; with builtins; { in mapAttrsRecursiveCond (m: !(m ? iso)) (const buildIso) allMachines; tests = let - machineList = collect (m: m ? build) allMachines; + machineList = collect (m: m ? eval) allMachines; activatedTests = unique (concatMap (machine: - machine.build.config.vuizvui.requiresTests + machine.eval.config.vuizvui.requiresTests ) machineList); mkTest = path: setAttrByPath path (getAttrFromPath path allTests); in fold recursiveUpdate {} (map mkTest activatedTests) // { @@ -98,10 +98,10 @@ in with pkgsUpstream.lib; with builtins; { in { generic = mkChannel {}; - machines = mapAttrsRecursiveCond (m: !(m ? build)) (path: attrs: mkChannel { + machines = mapAttrsRecursiveCond (m: !(m ? eval)) (path: attrs: mkChannel { name = "machine-${last path}"; - constituents = singleton attrs.build.config.system.build.toplevel - ++ gatherTests attrs.build.config.vuizvui.requiresTests; + constituents = singleton attrs.eval.config.system.build.toplevel + ++ gatherTests attrs.eval.config.vuizvui.requiresTests; }) allMachines; }; |