diff --git a/outputs.nix b/outputs.nix index aced032..f69f3bf 100644 --- a/outputs.nix +++ b/outputs.nix @@ -22,22 +22,22 @@ self = { filePaths = lib.pipe ./hosts [ builtins.readDir ( lib.filterAttrs (name: type: - # filter out non-nix files - type == "regular" - # filter out files that don't end in .nix - && lib.hasSuffix ".nix" name + ( # regular .nix files + (type == "regular" && lib.hasSuffix ".nix" name) + || # directories that contain a default.nix file + (type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix") + ) # filter out files that start with . && !lib.hasPrefix "." name )) - (lib.mapAttrsToList (name: _: name)) ]; nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; in # mapped list of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names lib.pipe filePaths [ - (builtins.map (name: { - name = builtins.substring 0 (builtins.stringLength name - 4) name; + (builtins.mapAttrs (name: type: { + name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; value = nixosSystem { inherit lib; modules = [ @@ -53,6 +53,7 @@ self = { specialArgs = { inherit self inputs; }; }; })) + builtins.attrValues builtins.listToAttrs ]; };