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-hashhash β the hash you're expecting the file to have.--hash-typehash-algo β which hash algorithm to use. Your choices:blake3,md5,sha1,sha256, orsha512. 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.--namename β overrides the name component of the resulting store path. Defaults to the base name ofurl.--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 π
π§ Logging-related options
--debugβ sets the logging verbosity level todebug. Turn the volume all the way up.--log-formatformat β sets the format of log output; one ofraw,internal-json,barorbar-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 βοΈ--optionname value β sets the Nix configuration setting name to value (overridingnix.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
- fedora 44: nix-core 2.35.3-2.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms