pkgs/den-http-get-updater: allow to provide unpack and name argument per prefetch
This commit is contained in:
parent
517ca95d8d
commit
735a41ca0f
1 changed files with 10 additions and 5 deletions
|
@ -23,6 +23,8 @@
|
|||
# };
|
||||
# prefetchHash: string?;
|
||||
# targetHash: string?;
|
||||
# unpack: bool?;
|
||||
# name: string?;
|
||||
# }[]
|
||||
#
|
||||
prefetchList ? [],
|
||||
|
@ -38,7 +40,6 @@
|
|||
unpack ? true,
|
||||
hashAlgo ? "sha256",
|
||||
hashFormat ? "sri",
|
||||
name ? if unpack then "source" else null,
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -52,7 +53,8 @@ let
|
|||
);
|
||||
assert lib.isAttrs x.prefetchUrlLocation && lib.isString x.prefetchUrlLocation.attrpath or null;
|
||||
rec {
|
||||
inherit fileLocation hashAlgo hashFormat;
|
||||
inherit fileLocation hashAlgo hashFormat unpack;
|
||||
name = if x.unpack or unpack then "source" else null;
|
||||
mark = builtins.hashString "sha256" x.previousHash;
|
||||
markRegexEscape = lib.escapeRegex mark;
|
||||
realFileLocation = builtins.toString x.fileLocation or fileLocation;
|
||||
|
@ -66,8 +68,6 @@ let
|
|||
|
||||
previousVersionRegexEscape = lib.escapeRegex previousVersion;
|
||||
|
||||
nixUnpack = lib.optionalString unpack "--unpack";
|
||||
nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\"";
|
||||
|
||||
path = lib.makeBinPath ([
|
||||
curl
|
||||
|
@ -104,10 +104,15 @@ writeScript "den-http-get-updater" (''
|
|||
+ lib.concatStringsSep "\n" (lib.map ({
|
||||
fileLocation,
|
||||
markRegexEscape,
|
||||
name,
|
||||
prefetchUrlLocationShellEscape,
|
||||
realFileLocationShellEscape,
|
||||
unpack,
|
||||
...
|
||||
}: ''
|
||||
}: let
|
||||
nixUnpack = lib.optionalString unpack "--unpack";
|
||||
nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\"";
|
||||
in ''
|
||||
nixUrlsResult=$(nix-instantiate --eval --json --strict \
|
||||
"${prefetchUrlLocationShellEscape.file}" \
|
||||
-A "${prefetchUrlLocationShellEscape.attrpath}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue