fetchs3: init simple S3 downloader

+31
+29
pkgs/build-support/fetchs3/default.nix
··· 1 + { stdenv, runCommand, awscli }: 2 + 3 + { s3url 4 + , sha256 5 + , region ? "us-east-1" 6 + , credentials ? null # Default to looking at local EC2 metadata service 7 + , executable ? false 8 + , recursiveHash ? false 9 + , postFetch ? null 10 + }: 11 + 12 + let 13 + credentialAttrs = stdenv.lib.optionalAttrs (credentials != null) { 14 + AWS_ACCESS_KEY_ID = credentials.access_key_id; 15 + AWS_SECRET_ACCESS_KEY = credentials.secret_access_key; 16 + AWS_SESSION_TOKEN = credentials.session_token ? null; 17 + }; 18 + in runCommand "foo" ({ 19 + buildInputs = [ awscli ]; 20 + outputHashAlgo = "sha256"; 21 + outputHash = sha256; 22 + outputHashMode = if recursiveHash then "recursive" else "flat"; 23 + } // credentialAttrs) (if postFetch != null then '' 24 + downloadedFile="$(mktemp)" 25 + aws s3 cp ${s3url} $downloadedFile 26 + ${postFetch} 27 + '' else '' 28 + aws s3 cp ${s3url} $out 29 + '')
+2
pkgs/top-level/all-packages.nix
··· 153 153 154 154 fetchpatch = callPackage ../build-support/fetchpatch { }; 155 155 156 + fetchs3 = callPackage ../build-support/fetchs3 { }; 157 + 156 158 fetchsvn = callPackage ../build-support/fetchsvn { 157 159 sshSupport = true; 158 160 };