about summary refs log tree commit diff
path: root/configurations
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--configurations/default.nix190
-rw-r--r--configurations/manwe/default.nix2
-rw-r--r--configurations/melian/default.nix3
-rw-r--r--configurations/test-headful/default.nix10
-rw-r--r--configurations/test-headless/default.nix11
-rw-r--r--configurations/varda/default.nix2
-rw-r--r--configurations/yavanna/default.nix2
7 files changed, 64 insertions, 156 deletions
diff --git a/configurations/default.nix b/configurations/default.nix
index e0741dc..124baec 100644
--- a/configurations/default.nix
+++ b/configurations/default.nix
@@ -2,138 +2,72 @@
   inputs,
   lib,
 }:
-with lib; {
-  # TODO Make a generic wrapper for all hosts.
-  melian = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
-      modules =
-        attrValues inputs.self.nixosModules
-        ++ [./melian]
-        ++ (with inputs;
-          (with nixos-hardware.nixosModules; [
-            common-pc-laptop-ssd
-            lenovo-thinkpad-t480
-          ])
-          ++ [nixpkgs.nixosModules.notDetected]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = my.configurations.melian;
-      };
-    };
-
-  manwe = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
-      modules =
-        attrValues inputs.self.nixosModules
-        ++ [./manwe]
-        ++ (with inputs;
-          (with nixos-hardware.nixosModules; [common-cpu-amd common-pc-ssd])
-          ++ [
-            nixpkgs.nixosModules.notDetected
-            "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
-          ]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = my.configurations.manwe;
-      };
-    };
-
-  varda = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
-      modules =
-        attrValues inputs.self.nixosModules
-        ++ [./varda]
-        ++ (with inputs;
-          (with nixos-hardware.nixosModules; [common-cpu-amd common-pc-ssd])
-          ++ [
-            nixpkgs.nixosModules.notDetected
-            "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
-          ]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = my.configurations.varda;
-      };
-    };
-
-  yavanna = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
+with lib; let
+  mkConfiguration = name: {
+    modules ? [],
+    configuration ? ./${name},
+    this ? my.configurations.${name},
+  }:
+    nameValuePair name (nixosSystem {
+      inherit (this) system;
       modules =
         attrValues inputs.self.nixosModules
-        ++ [./yavanna]
-        ++ (with inputs;
-          (with nixos-hardware.nixosModules; [common-cpu-intel common-pc-hdd])
-          ++ [nixpkgs.nixosModules.notDetected]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = my.configurations.yavanna;
+        ++ modules
+        ++ [(import configuration)];
+      specialArgs = {inherit inputs lib this;};
+    });
+in
+  mapAttrs' mkConfiguration {
+    melian.modules = with inputs; [
+      nixos-hardware.nixosModules.common-pc-laptop-ssd
+      nixos-hardware.nixosModules.lenovo-thinkpad-t480
+      nixpkgs.nixosModules.notDetected
+    ];
+
+    manwe.modules = with inputs; [
+      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
+      nixos-hardware.nixosModules.common-cpu-amd
+      nixos-hardware.nixosModules.common-pc-ssd
+      nixpkgs.nixosModules.notDetected
+    ];
+
+    varda.modules = with inputs; [
+      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
+      nixos-hardware.nixosModules.common-cpu-amd
+      nixos-hardware.nixosModules.common-pc-ssd
+      nixpkgs.nixosModules.notDetected
+    ];
+
+    yavanna.modules = with inputs; [
+      "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
+      nixos-hardware.nixosModules.common-cpu-intel
+      nixos-hardware.nixosModules.common-pc-hdd
+      nixpkgs.nixosModules.notDetected
+    ];
+
+    test-headless = {
+      modules = with inputs; [
+        "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
+        nixpkgs.nixosModules.notDetected
+      ];
+      this = {
+        hostname = "test-headless";
+        system = "x86_64-linux";
+        isHeadless = true;
+        isHeadful = false;
       };
     };
 
-  test-headless = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
-      modules =
-        attrValues inputs.self.nixosModules
-        ++ [./test-headless]
-        ++ (with inputs; [
-          nixpkgs.nixosModules.notDetected
-          "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
-        ]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = {
-          hostname = "test-headless";
-          isHeadless = true;
-          isHeadful = false;
-        };
-      };
-    };
-
-  test-headful = let
-    system = "x86_64-linux";
-  in
-    nixosSystem {
-      inherit system;
-
-      modules =
-        attrValues inputs.self.nixosModules
-        ++ [./test-headful]
-        ++ (with inputs; [
-          nixpkgs.nixosModules.notDetected
-          "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
-        ]);
-
-      specialArgs = rec {
-        inherit inputs lib;
-        this = {
-          hostname = "test-headful";
-          isHeadful = true;
-          isHeadless = false;
-        };
+    test-headful = {
+      modules = with inputs; [
+        "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
+        nixpkgs.nixosModules.notDetected
+      ];
+      this = {
+        hostname = "test-headful";
+        system = "x86_64-linux";
+        isHeadless = false;
+        isHeadful = true;
       };
     };
-}
+  }
diff --git a/configurations/manwe/default.nix b/configurations/manwe/default.nix
index f3b59f5..656667e 100644
--- a/configurations/manwe/default.nix
+++ b/configurations/manwe/default.nix
@@ -167,6 +167,4 @@ with lib; {
   };
 
   swapDevices = [{device = "/dev/sda3";}];
-
-  system.stateVersion = "22.05";
 }
diff --git a/configurations/melian/default.nix b/configurations/melian/default.nix
index 229b56a..8540c24 100644
--- a/configurations/melian/default.nix
+++ b/configurations/melian/default.nix
@@ -279,7 +279,4 @@ with lib; {
 
     xserver.videoDrivers = ["intel" "modesetting"];
   };
-
-  # TODO This should be applied globally to all machines.
-  system.stateVersion = "22.05";
 }
diff --git a/configurations/test-headful/default.nix b/configurations/test-headful/default.nix
index fb3c276..25db8c7 100644
--- a/configurations/test-headful/default.nix
+++ b/configurations/test-headful/default.nix
@@ -1,11 +1,5 @@
-{
-  lib,
-  modulesPath,
-  ...
-}:
+{lib, ...}:
 with lib; {
-  imports = ["${modulesPath}/profiles/qemu-guest.nix"];
-
   nixfiles.modules = {
     dwm.enable = true;
     kde.enable = false;
@@ -22,6 +16,4 @@ with lib; {
       man-db.enable = mkForce false;
     };
   };
-
-  system.stateVersion = "22.05";
 }
diff --git a/configurations/test-headless/default.nix b/configurations/test-headless/default.nix
index c085e63..919a436 100644
--- a/configurations/test-headless/default.nix
+++ b/configurations/test-headless/default.nix
@@ -1,12 +1,5 @@
-{
-  lib,
-  modulesPath,
-  ...
-}:
+{lib, ...}:
 with lib; {
-  imports = ["${modulesPath}/profiles/qemu-guest.nix"];
-
-  # This will allow `nix flake check` tests to pass.
   nixfiles.modules = {
     endlessh-go.enable = mkForce false;
     node-exporter.enable = mkForce false;
@@ -17,6 +10,4 @@ with lib; {
   fileSystems."/".device = "/dev/null";
 
   documentation.enable = mkForce false;
-
-  system.stateVersion = "22.05";
 }
diff --git a/configurations/varda/default.nix b/configurations/varda/default.nix
index 524842e..313d2fb 100644
--- a/configurations/varda/default.nix
+++ b/configurations/varda/default.nix
@@ -84,6 +84,4 @@ with lib; {
       size = 4 * 1024;
     }
   ];
-
-  system.stateVersion = "22.05";
 }
diff --git a/configurations/yavanna/default.nix b/configurations/yavanna/default.nix
index b740da3..3ed114e 100644
--- a/configurations/yavanna/default.nix
+++ b/configurations/yavanna/default.nix
@@ -96,6 +96,4 @@ with lib; {
       size = 4 * 1024;
     }
   ];
-
-  system.stateVersion = "22.05";
 }

Consider giving Nix/NixOS a try! <3