about summary refs log tree commit diff
path: root/hosts/default.nix
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2022-06-20 17:35:20 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-06-20 17:35:20 +0200
commitdfc07373c244bfdb797e70cf4206822161947bfc (patch)
tree226fcaa4ef5a82c27b10687850e9a37b5f6afb66 /hosts/default.nix
parentAdd VM host (diff)
downloadnixos-config-dfc07373c244bfdb797e70cf4206822161947bfc.tar.gz
nixos-config-dfc07373c244bfdb797e70cf4206822161947bfc.tar.bz2
nixos-config-dfc07373c244bfdb797e70cf4206822161947bfc.zip
Create mkHost utility function
Diffstat (limited to 'hosts/default.nix')
-rw-r--r--hosts/default.nix69
1 files changed, 34 insertions, 35 deletions
diff --git a/hosts/default.nix b/hosts/default.nix
index bd6dccb..83d682f 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -1,42 +1,41 @@
 { user, lib, nixpkgs, nur, inputs, home-manager, ... }:
 let
-  system = "x86_64-linux"; # System architecture
-
-  pkgs = import nixpkgs {
-    inherit system;
-    config.allowUnfree = true; # Allow proprietary software
-    overlays = [
-      nur.overlay
-      (import ../packages)
-      (import ../overlays)
-    ];
-  };
-
-  inherit (nixpkgs.lib);
-
-  secrets = import ../secrets;
-
-  mkHost = hostname: lib.nixosSystem {
-    inherit system;
-    specialArgs = { inherit pkgs inputs user secrets hostname; };
-    modules = [
-      ./configuration.nix
-      ./${hostname}
-      home-manager.nixosModules.home-manager
-      {
-        home-manager.useGlobalPkgs = true;
-        home-manager.useUserPackages = true;
-        home-manager.extraSpecialArgs = { inherit pkgs user secrets hostname inputs; };
-        home-manager.users.${user} = {
-          imports = [ ./home.nix ] ++ [ (import ./${ hostname }/home.nix) ];
-        };
-      }
-    ];
-  };
+  mkHost = hostname: system:
+    let
+      pkgs = import nixpkgs {
+        inherit system;
+        config.allowUnfree = true; # Allow proprietary software
+        overlays = [
+          nur.overlay
+          (import ../packages)
+          (import ../overlays)
+        ];
+      };
+      secrets = import ../secrets;
+    in
+    nixpkgs.lib.nixosSystem {
+      inherit system;
+      specialArgs = {
+        inherit pkgs inputs user secrets hostname;
+      };
+      modules = [
+        ./configuration.nix
+        ./${hostname}
+        home-manager.nixosModules.home-manager
+        {
+          home-manager.useGlobalPkgs = true;
+          home-manager.useUserPackages = true;
+          home-manager.extraSpecialArgs = { inherit pkgs user secrets hostname inputs; };
+          home-manager.users.${user} = {
+            imports = [ ./home.nix ] ++ [ (import ./${ hostname }/home.nix) ];
+          };
+        }
+      ];
+    };
 in
 let hosts = [ "baitinq" "vm" ]; #TODO: generate from here. List to set + apply func
 in
 {
-  baitinq = mkHost "baitinq";
-  vm = mkHost "vm";
+  baitinq = mkHost "baitinq" "x86_64-linux";
+  vm = mkHost "vm" "x86_64-linux";
 }