about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-05-03 01:57:40 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-05-03 02:49:38 +0200
commit603803164610371275b0054262e6de584b78eabe (patch)
treea9c34abe2efb6ec2c0f569c932209b7c6429c2ac
parent075067bfa2a59c39e960aba92f798cd626cd073d (diff)
machines/labtops: Switch to use callMachines
Should make the configurations much more easy to read.

I did a small comparison between the machine derivations of the old
Labtop and the Labtop with the new callMachines implementation using:

diff -U 0 =(nix-store -qR old_labtop.drv | sort -t- -k 2) \
          =(nix-store -qR new_labtop.drv | sort -t- -k 2)

The following store paths were different in the output:

  /nix/store/...-etc.drv
  /nix/store/...-initrd.drv
  /nix/store/...-kernel-modules-shrunk.drv
  /nix/store/...-nixos.conf.drv
  /nix/store/...-nixos-system-labtop-16.09pre82222.fc92bbf-vuizvui.drv
  /nix/store/...-stage-1-init.sh.drv
  /nix/store/...-system-units.drv
  /nix/store/...-unit-systemd-modules-load.service.drv

This is okay and is due to the reversed module evaluation order, because
we now have the module definition enabling the Labtop profile in
extraConfig instead of in the root config.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @Profpatsch
-rw-r--r--machines/default.nix4
-rw-r--r--machines/labnet/labtop.nix19
2 files changed, 5 insertions, 18 deletions
diff --git a/machines/default.nix b/machines/default.nix
index 11335a14..13cf8f6e 100644
--- a/machines/default.nix
+++ b/machines/default.nix
@@ -27,7 +27,9 @@ in {
     };
   };
   labnet = {
-    labtops = import ./labnet/labtop.nix { inherit (nixpkgs) lib; };
+    labtops = callMachines ./labnet/labtop.nix {
+      extraConfig.vuizvui.user.openlab.labtops.enable = true;
+    };
   };
   profpatsch = {
     katara = callMachine ./profpatsch/katara.nix {};
diff --git a/machines/labnet/labtop.nix b/machines/labnet/labtop.nix
index 099925fa..cee5c11b 100644
--- a/machines/labnet/labtop.nix
+++ b/machines/labnet/labtop.nix
@@ -1,15 +1,5 @@
-{ lib }:
-let
-  callMachine = import ../../lib/call-machine.nix;
-  mkLabtop = hostname: config: {
-    imports = [ config ];
-    vuizvui.user.openlab.labtops.enable = true;
-    networking.hostName = hostname;
-  };
-  mkLabtops = lib.mapAttrs (name: cfg: callMachine (mkLabtop name cfg) {});
-
+{
   labtop = {
-
     boot.kernelModules = [ "kvm-intel" ];
     boot.initrd.availableKernelModules = [
       "uhci_hcd" "ehci_pci" "ata_piix" "firewire_ohci" "usb_storage"
@@ -21,19 +11,14 @@ let
 
     networking.enableIntel3945ABGFirmware = true;
 
-
     users.users.kevin = {
       isNormalUser = true;
       password = "kevin";
     };
     users.users.root.password = "root";
-
   };
 
-
   hannswurscht = {
     nixpkgs.system = "i686-linux";
   };
-
-in
-  mkLabtops { inherit labtop hannswurscht; }
+}