home-manager/files/mutable-files: revise custom script

This commit is contained in:
Gabriel Arazas 2024-02-13 12:26:14 +08:00
parent 98f2bbe59a
commit 7736fd7059
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -34,7 +34,15 @@ let
gopass = ''
[ -e ${path} ] || gopass clone ${extraArgs} ${url} --path ${path} ${extraArgs}
'';
custom = "[ -e ${path} ] || ${extraArgs}";
custom = ''
# Allow the extra arguments to make use of the URL and path thru
# variables.
(
url=${url}
path=${path}
[ -e ${path} ] || ${extraArgs}
)
'';
};
fileType = baseDir: { name, config, options, ... }: {
@ -84,7 +92,9 @@ let
- For `gopass`, the file will be cloned with {command}`gopass`.
- For `custom`, the file will be passed with a user-given command.
The `extraArgs` option is now assumed to be a list of a command and
its arguments.
its arguments. To make executing commands possible with custom
scripts, the URL and the path is stored in shell variables `$url` and
`$path` respectively.
The default type is `fetch`.
'';