about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-10 17:46:13 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-10 17:46:13 -0800
commit446f2ac62e23507dc704471987388382fb238f6d (patch)
treee1633b73183d64ae80fd37ded28a4dbe3c4db193 /lib
parenthome-manager: fix mpd config (diff)
downloadworld-446f2ac62e23507dc704471987388382fb238f6d.tar.gz
home-manager: split the configuration
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
new file mode 100644
index 0000000..7f0f8ed
--- /dev/null
+++ b/lib/default.nix
@@ -0,0 +1,62 @@
+{ inputs, overlays }:
+{
+  mkSystem =
+    { hostname
+    , system
+    , desktop ? false
+    }:
+    inputs.nixpkgs.lib.nixosSystem {
+      inherit system;
+      specialArgs = {
+        inherit inputs system hostname desktop;
+      };
+      modules = [
+        ../modules/deskop
+        ../modules/system
+        ../hosts/${hostname}
+        {
+          networking.hostName = hostname;
+          # Apply overlay and allow unfree packages
+          nixpkgs = {
+            inherit overlays;
+            config.allowUnfree = true;
+          };
+          # Add each input as a registry
+          nix.registry = inputs.nixpkgs.lib.mapAttrs'
+            (n: v:
+              inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; }))
+            inputs;
+        }
+      ]
+    };
+
+  mkHome =
+    { username
+    , system
+    , hostname
+    , desktop ? false
+    }:
+    inputs.home-manager.lib.homeManagerConfiguration {
+      inherit username system;
+      extraSpecialArgs = {
+        inherit system hostname graphical;
+      };
+      homeDirectory = "/home/${username}";
+      configuration = ../users/${username};
+      extraModules = [
+        ../modules/home-manager
+        # Base configuration
+        {
+          nixpkgs = {
+            inherit overlays;
+            config.allowUnfree = true;
+          };
+          programs = {
+            home-manager.enable = true;
+            git.enable = true;
+          };
+          systemd.user.startServices = "sd-switch";
+        }
+      ];
+    };
+}