fetchs3: support hash attribute

This commit is contained in:
nicoo 2024-09-15 21:52:34 +00:00
parent b5aefcd40a
commit 1ccd5ba540

View File

@ -1,8 +1,9 @@
{ lib, runCommand, awscli }:
lib.fetchers.withNormalizedHash { } (
{ s3url
, name ? builtins.baseNameOf s3url
, sha256
, outputHash
, outputHashAlgo
, region ? "us-east-1"
, credentials ? null # Default to looking at local EC2 metadata service
, recursiveHash ? false
@ -20,8 +21,7 @@ let
in runCommand name ({
nativeBuildInputs = [ awscli ];
outputHashAlgo = "sha256";
outputHash = sha256;
inherit outputHash outputHashAlgo;
outputHashMode = if recursiveHash then "recursive" else "flat";
preferLocalBuild = true;
@ -34,3 +34,4 @@ in runCommand name ({
'' else ''
aws s3 cp ${s3url} $out
'')
)