diff options
Diffstat (limited to 'modules/files.nix')
| -rw-r--r-- | modules/files.nix | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/modules/files.nix b/modules/files.nix index dbd9c6b..14b5319 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -49,12 +49,13 @@ with builtins // lib; internal = true; default = pkgs.linkFarm "files" - <| flip mapAttrsToList config.files ( + <| mapAttrsToList ( _: { destination, source, ... }: { name = destination; path = source; } - ); + ) + <| filterAttrs (_: v: v.enable) config.files; }; dictionaries = mkOption { @@ -76,6 +77,10 @@ with builtins // lib; default = { }; type = with types; attrsOf path; }; + + patchDirectories = mkOption { + type = with types; listOf path; + }; }; config = { @@ -107,15 +112,31 @@ with builtins // lib; }; } )) - (flip mapAttrs' config.patches ( - name: source: { - name = "patch::${name}"; - value = { - destination = "patches/${name}"; - inherit source; + (mkIf (config.patchDirectories != [ ]) { + "patches" = { + source = pkgs.symlinkJoin { + name = "patches"; + paths = config.patchDirectories; }; - } - )) + }; + }) + # (flip mapAttrs' config.patches ( + # name: source: { + # name = "patch::${name}"; + # value = { + # destination = "patches/${name}"; + # inherit source; + # }; + # } + # )) ]; + + patchDirectories = mkIf (config.patches != { }) [ + ( + pkgs.linkFarm "individual-patches" + <| mapAttrsToList (name: path: { inherit name path; }) config.patches + ) + ]; + }; } |
