From b87ced9a95fd0de4e3631e67cc5a7a929adee464 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Wed, 28 Oct 2026 11:49:51 -0400 Subject: Working concept with an instance for my pocketbook --- modules/files.nix | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'modules/files.nix') 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 + ) + ]; + }; } -- cgit v1.3.1