about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-15 04:30:10 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-15 04:30:10 +0100
commit8c1b7661ae7801233df2ef5cacb07c7382d74fdd (patch)
treec69e6fddd776b5ce0c92f870437637de82e62191 /lib
parent2c5b52769214bfb36bdaf5957e32b667f7d87b65 (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>
Diffstat (limited to 'lib')
-rw-r--r--lib/call-machine.nix38
1 files changed, 21 insertions, 17 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;
 }