Warning
This program is experimental and its interface is subject to change.
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
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 overridden using --name.
Options
-
Make the resulting file executable. Note that this causes the resulting hash to be a NAR hash rather than a flat file hash.
-
--expected-hashhashThe expected hash of the file.
-
--hash-typehash-algohash algorithm ('md5', 'sha1', 'sha256', or 'sha512')
-
Produce output in JSON format, suitable for consumption by another program.
-
--namenameOverride the name component of the resulting store path. It defaults to the base name of url.
Logging-related options:
-
Set the logging verbosity level to 'debug'.
-
--log-formatformatSet the format of log output; one of
raw,internal-json,barorbar-with-logs. -
--print-build-logs/-LPrint full build logs on standard error.
-
Decrease the logging verbosity level.
-
--verbose/-vIncrease the logging verbosity level.
Miscellaneous global options:
-
Show usage information.
-
Disable substituters and consider all previously downloaded files up-to-date.
-
--optionname valueSet the Nix configuration setting name to value (overriding
nix.conf). -
Consider all previously downloaded files out-of-date.
-
Show version information.
Options to override configuration settings:
-
Enable the
accept-flake-configsetting. -
--access-tokensvalueSet the
access-tokenssetting. -
Enable the
allow-dirtysetting. -
--allow-import-from-derivationEnable the
allow-import-from-derivationsetting. -
Enable the
allow-new-privilegessetting. -
Enable the
allow-symlinked-storesetting. -
--allow-unsafe-native-code-during-evaluationEnable the
allow-unsafe-native-code-during-evaluationsetting. -
--allowed-impure-host-depsvalueSet the
allowed-impure-host-depssetting. -
--allowed-urisvalueSet the
allowed-urissetting. -
--allowed-usersvalueSet the
allowed-userssetting. -
Enable the
auto-allocate-uidssetting. -
Enable the
auto-optimise-storesetting. -
--bash-promptvalueSet the
bash-promptsetting. -
--bash-prompt-prefixvalueSet the
bash-prompt-prefixsetting. -
--bash-prompt-suffixvalueSet the
bash-prompt-suffixsetting. -
--build-hookvalueSet the
build-hooksetting. -
--build-poll-intervalvalueSet the
build-poll-intervalsetting. -
--build-users-groupvalueSet the
build-users-groupsetting. -
--buildersvalueSet the
builderssetting. -
Enable the
builders-use-substitutessetting. -
--commit-lockfile-summaryvalueSet the
commit-lockfile-summarysetting. -
Enable the
compress-build-logsetting. -
--connect-timeoutvalueSet the
connect-timeoutsetting. -
--coresvalueSet the
coressetting. -
--diff-hookvalueSet the
diff-hooksetting. -
--download-attemptsvalueSet the
download-attemptssetting. -
--download-speedvalueSet the
download-speedsetting. -
Enable the
eval-cachesetting. -
--experimental-featuresvalueSet the
experimental-featuressetting. -
--extra-access-tokensvalueAppend to the
access-tokenssetting. -
--extra-allowed-impure-host-depsvalueAppend to the
allowed-impure-host-depssetting. -
--extra-allowed-urisvalueAppend to the
allowed-urissetting. -
--extra-allowed-usersvalueAppend to the
allowed-userssetting. -
--extra-build-hookvalueAppend to the
build-hooksetting. -
--extra-experimental-featuresvalueAppend to the
experimental-featuressetting. -
--extra-extra-platformsvalueAppend to the
extra-platformssetting. -
--extra-hashed-mirrorsvalueAppend to the
hashed-mirrorssetting. -
--extra-ignored-aclsvalueAppend to the
ignored-aclssetting. -
--extra-nix-pathvalueAppend to the
nix-pathsetting. -
--extra-platformsvalueSet the
extra-platformssetting. -
--extra-plugin-filesvalueAppend to the
plugin-filessetting. -
--extra-sandbox-pathsvalueAppend to the
sandbox-pathssetting. -
--extra-secret-key-filesvalueAppend to the
secret-key-filessetting. -
--extra-substitutersvalueAppend to the
substituterssetting. -
--extra-system-featuresvalueAppend to the
system-featuressetting. -
--extra-trusted-public-keysvalueAppend to the
trusted-public-keyssetting. -
--extra-trusted-substitutersvalueAppend to the
trusted-substituterssetting. -
--extra-trusted-usersvalueAppend to the
trusted-userssetting. -
Enable the
fallbacksetting. -
Enable the
filter-syscallssetting. -
--flake-registryvalueSet the
flake-registrysetting. -
Enable the
fsync-metadatasetting. -
--gc-reserved-spacevalueSet the
gc-reserved-spacesetting. -
--hashed-mirrorsvalueSet the
hashed-mirrorssetting. -
--http-connectionsvalueSet the
http-connectionssetting. -
Enable the
http2setting. -
--id-countvalueSet the
id-countsetting. -
Enable the
ignore-trysetting. -
--ignored-aclsvalueSet the
ignored-aclssetting. -
Enable the
impersonate-linux-26setting. -
Enable the
keep-build-logsetting. -
Enable the
keep-derivationssetting. -
Enable the
keep-env-derivationssetting. -
Enable the
keep-failedsetting. -
Enable the
keep-goingsetting. -
Enable the
keep-outputssetting. -
--log-linesvalueSet the
log-linessetting. -
--max-build-log-sizevalueSet the
max-build-log-sizesetting. -
--max-freevalueSet the
max-freesetting. -
--max-jobsvalueSet the
max-jobssetting. -
--max-silent-timevalueSet the
max-silent-timesetting. -
--max-substitution-jobsvalueSet the
max-substitution-jobssetting. -
--min-freevalueSet the
min-freesetting. -
--min-free-check-intervalvalueSet the
min-free-check-intervalsetting. -
--nar-buffer-sizevalueSet the
nar-buffer-sizesetting. -
--narinfo-cache-negative-ttlvalueSet the
narinfo-cache-negative-ttlsetting. -
--narinfo-cache-positive-ttlvalueSet the
narinfo-cache-positive-ttlsetting. -
--netrc-filevalueSet the
netrc-filesetting. -
--nix-pathvalueSet the
nix-pathsetting. -
Disable the
accept-flake-configsetting. -
Disable the
allow-dirtysetting. -
--no-allow-import-from-derivationDisable the
allow-import-from-derivationsetting. -
Disable the
allow-new-privilegessetting. -
Disable the
allow-symlinked-storesetting. -
--no-allow-unsafe-native-code-during-evaluationDisable the
allow-unsafe-native-code-during-evaluationsetting. -
Disable the
auto-allocate-uidssetting. -
Disable the
auto-optimise-storesetting. -
Disable the
builders-use-substitutessetting. -
Disable the
compress-build-logsetting. -
Disable the
eval-cachesetting. -
Disable the
fallbacksetting. -
Disable the
filter-syscallssetting. -
Disable the
fsync-metadatasetting. -
Disable the
http2setting. -
Disable the
ignore-trysetting. -
Disable the
impersonate-linux-26setting. -
Disable the
keep-build-logsetting. -
Disable the
keep-derivationssetting. -
Disable the
keep-env-derivationssetting. -
Disable the
keep-failedsetting. -
Disable the
keep-goingsetting. -
Disable the
keep-outputssetting. -
Disable the
preallocate-contentssetting. -
Disable the
print-missingsetting. -
Disable the
pure-evalsetting. -
--no-require-drop-supplementary-groupsDisable the
require-drop-supplementary-groupssetting. -
Disable the
require-sigssetting. -
Disable the
restrict-evalsetting. -
Disable the
run-diff-hooksetting. -
Disable sandboxing.
-
Disable the
sandbox-fallbacksetting. -
Disable the
show-tracesetting. -
Disable the
substitutesetting. -
Disable the
sync-before-registeringsetting. -
Disable the
trace-function-callssetting. -
Disable the
trace-verbosesetting. -
Disable the
use-case-hacksetting. -
Disable the
use-cgroupssetting. -
Disable the
use-registriessetting. -
Disable the
use-sqlite-walsetting. -
Disable the
use-xdg-base-directoriessetting. -
Disable the
warn-dirtysetting. -
--plugin-filesvalueSet the
plugin-filessetting. -
--post-build-hookvalueSet the
post-build-hooksetting. -
--pre-build-hookvalueSet the
pre-build-hooksetting. -
Enable the
preallocate-contentssetting. -
Enable the
print-missingsetting. -
Enable the
pure-evalsetting. -
Enable sandboxing, but allow builds to disable it.
-
--require-drop-supplementary-groupsEnable the
require-drop-supplementary-groupssetting. -
Enable the
require-sigssetting. -
Enable the
restrict-evalsetting. -
Enable the
run-diff-hooksetting. -
Enable sandboxing.
-
--sandbox-build-dirvalueSet the
sandbox-build-dirsetting. -
--sandbox-dev-shm-sizevalueSet the
sandbox-dev-shm-sizesetting. -
Enable the
sandbox-fallbacksetting. -
--sandbox-pathsvalueSet the
sandbox-pathssetting. -
--secret-key-filesvalueSet the
secret-key-filessetting. -
Enable the
show-tracesetting. -
--ssl-cert-filevalueSet the
ssl-cert-filesetting. -
--stalled-download-timeoutvalueSet the
stalled-download-timeoutsetting. -
--start-idvalueSet the
start-idsetting. -
--storevalueSet the
storesetting. -
Enable the
substitutesetting. -
--substitutersvalueSet the
substituterssetting. -
Enable the
sync-before-registeringsetting. -
--systemvalueSet the
systemsetting. -
--system-featuresvalueSet the
system-featuressetting. -
--tarball-ttlvalueSet the
tarball-ttlsetting. -
--timeoutvalueSet the
timeoutsetting. -
Enable the
trace-function-callssetting. -
Enable the
trace-verbosesetting. -
--trusted-public-keysvalueSet the
trusted-public-keyssetting. -
--trusted-substitutersvalueSet the
trusted-substituterssetting. -
--trusted-usersvalueSet the
trusted-userssetting. -
Enable the
use-case-hacksetting. -
Enable the
use-cgroupssetting. -
Enable the
use-registriessetting. -
Enable the
use-sqlite-walsetting. -
Enable the
use-xdg-base-directoriessetting. -
--user-agent-suffixvalueSet the
user-agent-suffixsetting. -
Enable the
warn-dirtysetting.