diff --git a/flake.nix b/flake.nix index 70e0c4d..c91f4eb 100644 --- a/flake.nix +++ b/flake.nix @@ -56,9 +56,18 @@ }) (builtins.readDir ./modules); - nixosConfigurations = builtins.mapAttrs - (_: lib.nixosSystem) - (import ./hosts { imports = builtins.attrValues self.nixosModules; }); + nixosConfigurations = lib.genAttrs + (builtins.attrNames (builtins.readDir ./hosts)) + (name: + let cfg = import (./hosts + "/${name}"); + in lib.nixosSystem { + inherit (cfg) system; + modules = + cfg.modules ++ + [{ networking.hostName = name; }] ++ + (builtins.attrValues self.nixosModules); + } + ); packages = forAllSystems (system: mypkgs nixpkgs.legacyPackages.${system}); diff --git a/hosts/default.nix b/hosts/default.nix deleted file mode 100644 index 00c0af3..0000000 --- a/hosts/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -nixosModule: - -builtins.mapAttrs - - (name: system: { - inherit system; - modules = [ - nixosModule - (./. + "/${name}") - { networking.hostName = name; } - ]; - }) - -{ - hp = "x86_64-linux"; - levi = "x86_64-linux"; - testbox = "x86_64-linux"; -} diff --git a/hosts/hp/default.nix b/hosts/hp/default.nix new file mode 100644 index 0000000..ed47c7d --- /dev/null +++ b/hosts/hp/default.nix @@ -0,0 +1,6 @@ +{ + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ]; +} diff --git a/hosts/levi/default.nix b/hosts/levi/default.nix new file mode 100644 index 0000000..ed47c7d --- /dev/null +++ b/hosts/levi/default.nix @@ -0,0 +1,6 @@ +{ + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ]; +} diff --git a/hosts/testbox/default.nix b/hosts/testbox/default.nix new file mode 100644 index 0000000..ed47c7d --- /dev/null +++ b/hosts/testbox/default.nix @@ -0,0 +1,6 @@ +{ + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ]; +}