tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
fetchs3: init simple S3 downloader
Dan Peebles
8 years ago
9e764af7
5aa936d0
+31
2 changed files
expand all
collapse all
unified
split
pkgs
build-support
fetchs3
default.nix
top-level
all-packages.nix
+29
pkgs/build-support/fetchs3/default.nix
···
1
1
+
{ stdenv, runCommand, awscli }:
2
2
+
3
3
+
{ s3url
4
4
+
, sha256
5
5
+
, region ? "us-east-1"
6
6
+
, credentials ? null # Default to looking at local EC2 metadata service
7
7
+
, executable ? false
8
8
+
, recursiveHash ? false
9
9
+
, postFetch ? null
10
10
+
}:
11
11
+
12
12
+
let
13
13
+
credentialAttrs = stdenv.lib.optionalAttrs (credentials != null) {
14
14
+
AWS_ACCESS_KEY_ID = credentials.access_key_id;
15
15
+
AWS_SECRET_ACCESS_KEY = credentials.secret_access_key;
16
16
+
AWS_SESSION_TOKEN = credentials.session_token ? null;
17
17
+
};
18
18
+
in runCommand "foo" ({
19
19
+
buildInputs = [ awscli ];
20
20
+
outputHashAlgo = "sha256";
21
21
+
outputHash = sha256;
22
22
+
outputHashMode = if recursiveHash then "recursive" else "flat";
23
23
+
} // credentialAttrs) (if postFetch != null then ''
24
24
+
downloadedFile="$(mktemp)"
25
25
+
aws s3 cp ${s3url} $downloadedFile
26
26
+
${postFetch}
27
27
+
'' else ''
28
28
+
aws s3 cp ${s3url} $out
29
29
+
'')
+2
pkgs/top-level/all-packages.nix
···
153
153
154
154
fetchpatch = callPackage ../build-support/fetchpatch { };
155
155
156
156
+
fetchs3 = callPackage ../build-support/fetchs3 { };
157
157
+
156
158
fetchsvn = callPackage ../build-support/fetchsvn {
157
159
sshSupport = true;
158
160
};