mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-26 00:19:11 +00:00
modules/mutable-files: add extraArgs for file submodule
This commit is contained in:
parent
deea0e5dce
commit
56635f0502
@ -51,6 +51,17 @@ let
|
|||||||
default = "fetch";
|
default = "fetch";
|
||||||
example = "git";
|
example = "git";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraArgs = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
description = lib.mkDoc ''
|
||||||
|
A list of extra arguments to be included with the fetch command. Take
|
||||||
|
note of the commands used for each type as documented from
|
||||||
|
`config.home.mutableFile.<name>.type`.
|
||||||
|
'';
|
||||||
|
default = [];
|
||||||
|
example = [ "--depth" "1" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -101,13 +112,14 @@ in
|
|||||||
let
|
let
|
||||||
url = lib.escapeShellArg value.url;
|
url = lib.escapeShellArg value.url;
|
||||||
path = lib.escapeShellArg value.path;
|
path = lib.escapeShellArg value.path;
|
||||||
|
extraArgs = lib.escapeShellArgs value.extraArgs;
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
${lib.optionalString (value.type == "git") "[ -d ${path} ] || git clone ${url} ${path}"}
|
${lib.optionalString (value.type == "git") "[ -d ${path} ] || git clone ${extraArgs} ${url} ${path}"}
|
||||||
${lib.optionalString (value.type == "fetch") "[ -d ${path} ] || curl ${url} --output ${path}"}
|
${lib.optionalString (value.type == "fetch") "[ -e ${path} ] || curl ${extraArgs} ${url} --output ${path}"}
|
||||||
${lib.optionalString (value.type == "archive") ''
|
${lib.optionalString (value.type == "archive") ''
|
||||||
[ -d ${path} ] || {
|
[ -e ${path} ] || {
|
||||||
filename=$(curl --output-dir /tmp --silent --show-error --write-out '%{filename_effective}' --remote-name --remote-header-name --location ${url})
|
filename=$(curl ${extraArgs} --output-dir /tmp --silent --show-error --write-out '%{filename_effective}' --remote-name --remote-header-name --location ${url})
|
||||||
${if (value.extractPath != null) then
|
${if (value.extractPath != null) then
|
||||||
''arc extract "/tmp/$filename" ${lib.escapeShellArg value.extractPath} ${path}''
|
''arc extract "/tmp/$filename" ${lib.escapeShellArg value.extractPath} ${path}''
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user