Warning: This program is experimental and its
interface is subject to change.
nix flake prefetch - download the source tree denoted by a flake
reference into the Nix store
nix flake prefetch [option…] flake-url
- •
- Download a tarball and unpack it:
# nix flake prefetch https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.5.tar.xz
Downloaded 'https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.5.tar.xz?narHash=sha256-3XYHZANT6AFBV0BqegkAZHbba6oeDkIUCDwbATLMhAY='
to '/nix/store/sl5vvk8mb4ma1sjyy03kwpvkz50hd22d-source' (hash
'sha256-3XYHZANT6AFBV0BqegkAZHbba6oeDkIUCDwbATLMhAY=').
- •
- Download the dwarffs flake (looked up in the flake registry):
# nix flake prefetch dwarffs --json
{"hash":"sha256-VHg3MYVgQ12LeRSU2PSoDeKlSPD8PYYEFxxwkVVDRd0="
,"storePath":"/nix/store/hang3792qwdmm2n0d9nsrs5n6bsws6kv-source"}
This command downloads the source tree denoted by flake reference
flake-url. Note that this does not need to be a flake (i.e. it does
not have to contain a flake.nix file).
- •
- --json
Produce output in JSON format, suitable for consumption by another
program.
Common evaluation options:
- --arg name expr
Pass the value expr as the argument name to Nix
functions.
- --argstr name string
Pass the string string as the argument name to Nix
functions.
- --eval-store store-url
The Nix store to use for evaluations.
- --impure
Allow access to mutable paths and repositories.
- --include / -I path
Add path to the list of locations used to look up <...> file
names.
- --override-flake original-ref resolved-ref
Override the flake registries, redirecting original-ref to
resolved-ref.
Common flake-related options:
- --commit-lock-file
Commit changes to the flake’s lock file.
- --inputs-from flake-url
Use the inputs of the specified flake as registry entries.
- --no-registries
Don’t allow lookups in the flake registries. This option is
deprecated; use --no-use-registries.
- --no-update-lock-file
Do not allow any updates to the flake’s lock file.
- --no-write-lock-file
Do not write the flake’s newly generated lock file.
- --override-input input-path flake-url
Override a specific flake input (e.g. dwarffs/nixpkgs). This implies
--no-write-lock-file.
- --recreate-lock-file
Recreate the flake’s lock file from scratch.
- --update-input input-path
Update a specific flake input (ignoring its previous entry in the lock
file).