about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-09 10:55:31 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-09 11:00:37 -0700
commit9511e0069947cf823df0676eb2e72d8777d5a467 (patch)
tree3f3312df36f089774240171166632f78aeb3d817 /nix
parentref(nix): rename lib/ to nix/ (diff)
downloadworld-9511e0069947cf823df0676eb2e72d8777d5a467.tar.gz
ref(nix): move the mkSystem function to its own file
Make the default system be x86-linux.

Change-Id: I13e00e4d4cb8b7c49cc549509e37a6d0f022a051
Reviewed-on: https://cl.fcuny.net/c/world/+/299
Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'nix')
-rw-r--r--nix/default.nix36
-rw-r--r--nix/mkSystem.nix27
2 files changed, 28 insertions, 35 deletions
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;
+    }
+  ];
+}