home-manager/files/mutable-files: properly group fetch subscripts

This commit is contained in:
Gabriel Arazas 2024-02-28 18:45:37 +08:00
parent c08289419c
commit 51f52dc3f9
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -35,13 +35,7 @@ let
[ -e ${path} ] || gopass clone ${extraArgs} ${url} --path ${path} ${extraArgs}
'';
custom = ''
# Allow the extra arguments to make use of the URL and path thru
# variables.
(
url=${url}
path=${path}
[ -e ${path} ] || ${extraArgs}
)
[ -e ${path} ] || ${extraArgs}
'';
};
@ -169,8 +163,19 @@ in
ExecStart =
let
mutableFilesCmds = lib.mapAttrsToList
(path: value:
(fetchScript path value).${value.type})
(path: value: let
url = lib.escapeShellArg value.url;
path = lib.escapeShellArg value.path;
in
''
(
URL=${url}
PATH=${path}
DIRNAME=$(dirname ${path})
mkdir -p "$DIRNAME"
${(fetchScript path value).${value.type}}
)
'')
cfg;
script = pkgs.writeShellApplication {