diff --git a/flake.nix b/flake.nix index 5b7e52a..f360d1a 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,9 @@ nvim, }@inputs: let + lib = inputs.nixpkgs.lib; + utils = import ./utils { inherit lib; }; + hostDirNames = utils.dirNames ./hosts; system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; @@ -59,20 +62,13 @@ in { nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # - nixosConfigurations = { - vm = nixpkgs.lib.nixosSystem { - modules = [ ./hosts/vm ]; + nixosConfigurations = lib.genAttrs hostDirNames ( + host: + nixpkgs.lib.nixosSystem { + modules = [ ./hosts/${host} ]; specialArgs = { inherit inputs; }; - }; - andromache = nixpkgs.lib.nixosSystem { - modules = [ ./hosts/andromache ]; - specialArgs = { inherit inputs; }; - }; - astyanax = nixpkgs.lib.nixosSystem { - modules = [ ./hosts/astyanax ]; - specialArgs = { inherit inputs; }; - }; - }; + } + ); homeConfigurations = { work = home-manager.lib.homeManagerConfiguration { inherit pkgs; diff --git a/utils/default.nix b/utils/default.nix new file mode 100644 index 0000000..741dc56 --- /dev/null +++ b/utils/default.nix @@ -0,0 +1,7 @@ +{ lib }: + +{ + dirNames = + path: + builtins.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir path)); +}