about summary refs log tree commit diff
path: root/lib/mk_system.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mk_system.nix')
-rw-r--r--lib/mk_system.nix45
1 files changed, 27 insertions, 18 deletions
diff --git a/lib/mk_system.nix b/lib/mk_system.nix
index 54dddbe..2aca550 100644
--- a/lib/mk_system.nix
+++ b/lib/mk_system.nix
@@ -1,23 +1,32 @@
-{ self, ... } @ args:
-
-{ name, nixpkgs, system ? "x86_64-linux", overlays ? null, extraModules ? null }:
-nixpkgs.lib.nixosSystem (
-  let
-    configFolder = "${self}/nixos";
-    entryPoint = "${configFolder}/${name}/configuration.nix";
-    hardware = "${configFolder}/${name}/hardware-configuration.nix";
-  in
-  {
-    system = system;
+{ self, unstable, ... } @ args:
+{
+  mkSystem = { name, nixpkgs ? unstable, system ? "x86_64-linux", overlays ? null, extraModules ? null }:
+    nixpkgs.lib.nixosSystem (
+      let
+        configFolder = "${self}/nixos";
+        entryPoint = "${configFolder}/${name}/configuration.nix";
+        hardware = "${configFolder}/${name}/hardware-configuration.nix";
+      in
+      {
+        system = system;
 
-    specialArgs = args;
+        specialArgs = args;
 
-    modules = [
-      {
-        networking.hostName = name;
-        nix.flakes.enable = true;
-        system.configurationRevision = self.rev or "dirty";
-        documentation.man = { enable = true; generateCaches = true; };
+        modules = [
+          {
+            networking.hostName = name;
+            nix.flakes.enable = true;
+            system.configurationRevision = self.rev or "dirty";
+            documentation.man = { enable = true; generateCaches = true; };
+          }
+          entryPoint
+          hardware
+          # TODO: import all modules (use mapModules?)
+          ../modules/flakes.nix
+          ../modules/nix.nix
+          ../modules/nixpkgs.nix
+        ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; }
+        ++ nixpkgs.lib.optionals (extraModules != null) extraModules;
       }
       entryPoint
       hardware