nix3-store-prefetch-file(1)

πŸ’Ύ nix3-store-prefetch-file(1) β€” the Nix manual's own "download that file for me rn" page πŸ’…

⚠️ Warning bestie β€” this program is experimental and its interface is subject to change. Like, don't build your whole personality on it, mkay? πŸ™ˆ

🌸 Name

nix store prefetch-file β€” download a file into the Nix store 🫢


✨ Synopsis

nix store prefetch-file [option…] url

πŸŽ€ Examples

  • Download a file to the Nix store:
# 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:
# 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

Okay so, this command goes and downloads the file at url straight into the Nix store. Then it prints out the store path it landed at, plus the cryptographic hash of the file's contents. That's it, that's the whole vibe ✨

The name component of the store path defaults to the last component of url, but you can override it with --name if you're feeling like a main character πŸ‘‘


πŸ‘‘ Options

  • --executable β€” makes the resulting file executable. Lowkey important: this causes the resulting hash to be a NAR hash rather than a flat file hash. Different hash energy entirely, no cap.
  • --expected-hash hash β€” the hash you're expecting the file to have.
  • --hash-type hash-algo β€” which hash algorithm to use. Your choices: blake3, md5, sha1, sha256, or sha512. Pick your fighter πŸ’…
  • --json β€” spits the output out in JSON format, suitable for another program to consume. Very "hand it off to a friend" of it.
  • --name name β€” overrides the name component of the resulting store path. Defaults to the base name of url.
  • --no-pretty β€” prints compact JSON output on a single line, even when the output is a terminal. Some commands may print multiple JSON objects on separate lines.
See --pretty.
  • --pretty β€” prints multi-line, indented JSON output, for readability. It's giving neat handwriting notes.
Default: indent if output is to a terminal. This option is only effective when --json is also specified.
  • --unpack β€” unpacks the archive (which must be a tarball or zip file) and adds the result to the Nix store. Opening the box instead of carrying it 🎁
  • --debug β€” sets the logging verbosity level to debug. Turn the volume all the way up.
  • --log-format format β€” sets the format of log output; one of raw, internal-json, bar or bar-with-logs.
  • --print-build-logs, -L β€” prints full build logs on standard error.
  • --quiet β€” decreases the logging verbosity level. Shhh 🀫
  • --verbose, -v β€” increases the logging verbosity level.

🌈 Miscellaneous global options

  • --help β€” show usage information.
  • --offline β€” disables substituters and considers all previously downloaded files up-to-date. Airplane mode but make it Nix ✈️
  • --option name value β€” sets the Nix configuration setting name to value (overriding nix.conf).
  • --refresh β€” considers all previously downloaded files out-of-date. Everything old is new again.
  • --version β€” show version information.
πŸ“Œ Note β€” see man nix.conf for overriding configuration settings with command line flags.

okay that's the whole page bestie, you ate that πŸ’– this is the manual's general commands page for nix3-store-prefetch-file(1) β€” that's the name on the header and the name stamped at the foot of the page, so that's all the source/version/date tea we've got πŸ“ go download something iconic πŸ¦‹βœ¨

πŸ“¦ where this page comes from