about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.nix15
-rw-r--r--nix/default.nix36
-rw-r--r--nix/mkSystem.nix27
3 files changed, 31 insertions, 47 deletions
diff --git a/flake.nix b/flake.nix
index d8990da..3f8a401 100644
--- a/flake.nix
+++ b/flake.nix
@@ -33,18 +33,9 @@
     let lib = import ./nix { inherit inputs; };
     in {
       nixosConfigurations = {
-        carmel = lib.mkSystem {
-          hostname = "carmel";
-          system = "x86_64-linux";
-        };
-        aptos = lib.mkSystem {
-          hostname = "aptos";
-          system = "x86_64-linux";
-        };
-        tahoe = lib.mkSystem {
-          hostname = "tahoe";
-          system = "x86_64-linux";
-        };
+        carmel = lib.mkSystem { hostname = "carmel"; };
+        aptos = lib.mkSystem { hostname = "aptos"; };
+        tahoe = lib.mkSystem { hostname = "tahoe"; };
       };
     } // inputs.utils.lib.eachDefaultSystem (system:
       let
diff --git a/nix/default.nix b/nix/default.nix
index 8b46c58..2dfd8a2 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,39 +1,5 @@
 { inputs }:
 
 {
-  mkSystem =
-    { hostname
-    , system
-    }:
-    inputs.nixpkgs.lib.nixosSystem {
-      inherit system;
-      specialArgs = {
-        inherit inputs system hostname;
-      };
-      modules = [
-        ../modules
-        ../hosts/${hostname}
-        ./private-wireguard.nix
-        {
-          networking.hostName = hostname;
-          nixpkgs = {
-            config.allowUnfree = true;
-            overlays = [
-              inputs.emacs-overlay.overlay
-              inputs.nur.overlay
-              (final: prev: {
-                tools = {
-                  gerrit-hook = import ../tools/gerrit-hook final;
-                };
-              })
-            ];
-          };
-          # Add each input as a registry
-          nix.registry = inputs.nixpkgs.lib.mapAttrs'
-            (n: v:
-              inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; }))
-            inputs;
-        }
-      ];
-    };
+  mkSystem = import ./mkSystem.nix inputs;
 }
diff --git a/nix/mkSystem.nix b/nix/mkSystem.nix
new file mode 100644
index 0000000..28e42b1
--- /dev/null
+++ b/nix/mkSystem.nix
@@ -0,0 +1,27 @@
+inputs@{ self, ... }:
+{ system ? "x86_64-linux", hostname, }:
+inputs.nixpkgs.lib.nixosSystem {
+  inherit system;
+  specialArgs = { inherit inputs system hostname; };
+  modules = [
+    "${self}/modules"
+    "${self}/hosts/${hostname}"
+    ./private-wireguard.nix
+    {
+      networking.hostName = hostname;
+      nixpkgs = {
+        config.allowUnfree = true;
+        overlays = [
+          inputs.emacs-overlay.overlay
+          inputs.nur.overlay
+          (final: prev: {
+            tools = { gerrit-hook = import ../tools/gerrit-hook final; };
+          })
+        ];
+      };
+      # Add each input as a registry
+      nix.registry = inputs.nixpkgs.lib.mapAttrs'
+        (n: v: inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) inputs;
+    }
+  ];
+}