nixos-dotfiles

nixos-dotfiles

https://git.tonybtw.com/nixos-dotfiles.git git://git.tonybtw.com/nixos-dotfiles.git

updated for modularity

Commit
1de8850adb44cccf6aa0070fa0e3374a75bf1861
Parent
29e374a
Author
tonybtw <tonybtw@tonybtw.com>
Date
2025-11-23 22:58:06

Diff

diff --git a/configuration.nix b/configuration.nix
index 532e8c3..53e6498 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -37,14 +37,12 @@
   #   patches = [];
   # });
 in {
-  imports = [
-    ./hardware-configuration.nix
-  ];
+  # hardware-configuration.nix imported per-host in flake.nix
 
   boot.loader.systemd-boot.enable = true;
   boot.loader.efi.canTouchEfiVariables = true;
 
-  networking.hostName = "nixos-btw";
+  # networking.hostName set per-host in flake.nix
   networking.networkmanager.enable = true;
 
   programs.nix-ld.enable = true;
diff --git a/flake.nix b/flake.nix
index 7753bb1..22a2389 100644
--- a/flake.nix
+++ b/flake.nix
@@ -51,6 +51,31 @@
       system = system;
       config.allowUnfree = true; # Sorry Uncle Richard
     };
+    mkHost = hostname:
+      nixpkgs.lib.nixosSystem {
+        system = system;
+        specialArgs = {inherit unstable_pkgs oxwm;};
+        modules = [
+          ./configuration.nix
+          ./hosts/${hostname}/hardware-configuration.nix
+          {networking.hostName = hostname;}
+          # ./modules/noctalia.nix
+          oxwm.nixosModules.default
+          # nwm.nixosModules.default
+          mango.nixosModules.mango
+          home-manager.nixosModules.home-manager
+          {
+            home-manager = {
+              useGlobalPkgs = true;
+              useUserPackages = true;
+              users.tony = import ./home.nix;
+              users.sandbox = import ./home-sandbox.nix;
+              backupFileExtension = "backup";
+              extraSpecialArgs = {inherit unstable_pkgs;};
+            };
+          }
+        ];
+      };
   in {
     devShells.${system}.st = pkgs.mkShell {
       # toolchain + headers/libs
@@ -67,27 +92,9 @@
         export PS1="(suckless-dev) $PS1"
       '';
     };
-    nixosConfigurations.nixos-btw = nixpkgs.lib.nixosSystem {
-      system = system;
-      specialArgs = {inherit unstable_pkgs oxwm;};
-      modules = [
-        ./configuration.nix
-        # ./modules/noctalia.nix
-        oxwm.nixosModules.default
-        # nwm.nixosModules.default
-        mango.nixosModules.mango
-        home-manager.nixosModules.home-manager
-        {
-          home-manager = {
-            useGlobalPkgs = true;
-            useUserPackages = true;
-            users.tony = import ./home.nix;
-            users.sandbox = import ./home-sandbox.nix;
-            backupFileExtension = "backup";
-            extraSpecialArgs = {inherit unstable_pkgs;};
-          };
-        }
-      ];
+    nixosConfigurations = {
+      nixos-btw = mkHost "nixos-btw";
+      nixos-srv = mkHost "nixos-srv";
     };
   };
 }
diff --git a/hardware-configuration.nix b/hosts/nixos-btw/hardware-configuration.nix
similarity index 100%
rename from hardware-configuration.nix
rename to hosts/nixos-btw/hardware-configuration.nix