diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-01-15 02:01:24 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-01-15 02:01:24 +0000 |
commit | 0027b05a15e5845c5ce70c86b5b1a34e7caff039 (patch) | |
tree | 9264ad326d070ec2dcf5d19a373721672eb1df2e /src/nix/store-prefetch-file.md | |
parent | fed123724679de89d3f56a4c01b5c4c96f93e584 (diff) | |
parent | 7a472a76d4dcbbd0eb7832c0bdcb120d32881e8b (diff) |
Merge remote-tracking branch 'upstream/master' into non-local-store-build
Diffstat (limited to 'src/nix/store-prefetch-file.md')
-rw-r--r-- | src/nix/store-prefetch-file.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nix/store-prefetch-file.md b/src/nix/store-prefetch-file.md new file mode 100644 index 000000000..1663b847b --- /dev/null +++ b/src/nix/store-prefetch-file.md @@ -0,0 +1,32 @@ +R""( + +# Examples + +* Download a file to the Nix store: + + ```console + # nix store prefetch-file https://releases.nixos.org/nix/nix-2.3.10/nix-2.3.10.tar.xz + Downloaded 'https://releases.nixos.org/nix/nix-2.3.10/nix-2.3.10.tar.xz' to + '/nix/store/vbdbi42hgnc4h7pyqzp6h2yf77kw93aw-source' (hash + 'sha256-qKheVd5D0BervxMDbt+1hnTKE2aRWC8XCAwc0SeHt6s='). + ``` + +* Download a file and get the SHA-512 hash: + + ```console + # nix store prefetch-file --json --hash-type sha512 \ + https://releases.nixos.org/nix/nix-2.3.10/nix-2.3.10.tar.xz \ + | jq -r .hash + sha512-6XJxfym0TNH9knxeH4ZOvns6wElFy3uahunl2hJgovACCMEMXSy42s69zWVyGJALXTI+86tpDJGlIcAySEKBbA== + ``` + +# Description + +This command downloads the file *url* to the Nix store. It prints out +the resulting store path and the cryptographic hash of the contents of +the file. + +The name component of the store path defaults to the last component of +*url*, but this can be overriden using `--name`. + +)"" |