nix3-copy(1)
π nix3-copy(1) β General Commands Manual π
β οΈ Warning: this program is experimental and its interface is subject to change. Like, fr fr, it might shift under you. Be aware bestie.
β¨ Name β¨
nix copy β copy paths between Nix stores π¦
πΈ Synopsis πΈ
nix copy [optionβ¦] installablesβ¦
π Examples π
- Copy Firefox from the local store to a binary cache in
/tmp/cache:
# nix copy --to file:///tmp/cache $(type -p firefox)
Note thefile://β without this, the destination is a chroot store, not a binary cache. Do not forget thefile://ok, it's giving "totally different thing" energy. π
- Copy all store paths from a local binary cache in
/tmp/cacheto the local store:
# nix copy --all --from file:///tmp/cache
- Copy the entire current NixOS system closure to another machine via SSH:
# nix copy --substitute-on-destination --to ssh://server /run/current-system
The-sflag causes the remote machine to try to substitute missing store paths, which may be faster if the link between the local and remote machines is slower than the link between the remote machine and its substituters (e.g.https://cache.nixos.org). Iconic bandwidth-saving behaviour honestly. π₯
- Copy a closure from another machine via SSH:
# nix copy --from ssh://server /nix/store/a6cnl93nk1wxnq84brbbwr6hxw9gp2w9-blender-2.79-rc2
- Copy Hello to a binary cache in an Amazon S3 bucket:
# nix copy --to s3://my-bucket?region=eu-west-1 nixpkgs#hello
or to an S3-compatible storage system:
# nix copy --to s3://my-bucket?region=eu-west-1&endpoint=example.com nixpkgs#hello
Note that this only works if Nix is built with AWS support. No AWS support, no S3 slay. π
- Copy a closure from
/nix/storeto the chroot store/tmp/nix/nix/store:
# nix copy --to /tmp/nix nixpkgs#hello --no-check-sigs
- Update the NixOS system profile to point to a closure copied from a remote machine:
# nix copy --from ssh://server \
--profile /nix/var/nix/profiles/system \
/nix/store/r14v3km89zm3prwsa521fab5kgzvfbw4-nixos-system-foobar-24.05.20240925.759537f
π Description π
nix copy copies store path closures between two Nix stores. The source store is specified using --from and the destination using --to. If one of these is omitted, it defaults to the local store. So like, it just knows where home is. π
π§ Options π§
--fromstore-uri β URL of the source Nix store.--no-check-sigsβ Do not require that paths are signed by trusted keys. Living dangerously, cute but scary. π--out-link,-opath β Create symlinks prefixed with path to the top-level store paths fetched from the source store.--profilepath β The profile to operate on.--stdinβ Read installables from the standard input. No default installable applied.--substitute-on-destination,-sβ Whether to try substitutes on the destination store (only supported by SSH stores).--tostore-uri β URL of the destination Nix store.
π Common evaluation options π
--argname expr β Pass the value expr as the argument name to Nix functions.--arg-from-filename path β Pass the contents of file path as the argument name to Nix functions.--arg-from-stdinname β Pass the contents of stdin as the argument name to Nix functions.--argstrname string β Pass the string string as the argument name to Nix functions.--debuggerβ Start an interactive environment if evaluation fails.--eval-storestore-url β The URL of the Nix store to use for evaluation, i.e. to store derivations (.drvfiles) and inputs referenced by them.--impureβ Allow access to mutable paths and repositories.--include,-Ipath β Add path to search path entries used to resolve lookup paths. This option may be given multiple times. Paths added through-Itake precedence over thenix-pathconfiguration setting and theNIX_PATHenvironment variable.--override-flakeoriginal-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-fromflake-url β Use the inputs of the specified flake as registry entries.--no-registriesβ Don't allow lookups in the flake registries.
DEPRECATED β Use --no-use-registries instead.
--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.--output-lock-fileflake-lock-path β Write the given lock file instead offlake.lockwithin the top-level flake.--override-inputinput-path flake-url β Override a specific flake input (e.g.dwarffs/nixpkgs). The input path must not be empty. This implies--no-write-lock-file.--recreate-lock-fileβ Recreate the flake's lock file from scratch.
DEPRECATED β Use nix flake update instead.
--reference-lock-fileflake-lock-path β Read the given lock file instead offlake.lockwithin the top-level flake.--update-inputinput-path β Update a specific flake input (ignoring its previous entry in the lock file).
DEPRECATED β Use nix flake update instead.
πΈ Logging-related options πΈ
--debugβ Set the logging verbosity level to 'debug'.--log-formatformat β Set the format of log output; one ofraw,internal-json,barorbar-with-logs.--print-build-logs,-Lβ Print full build logs on standard error.--quietβ Decrease the logging verbosity level.--verbose,-vβ Increase the logging verbosity level.
π Miscellaneous global options π
--helpβ Show usage information.--offlineβ Disable substituters and consider all previously downloaded files up-to-date.--optionname value β Set the Nix configuration setting name to value (overridingnix.conf).--refreshβ Consider all previously downloaded files out-of-date.--repairβ During evaluation, rewrite missing or corrupted files in the Nix store. During building, rebuild missing or corrupted store paths.--versionβ Show version information.
β Options that change the interpretation of installables β
--allβ Apply the operation to every store path.--derivationβ Operate on the store derivation rather than its outputs.--exprexpr β Interpret installables as attribute paths relative to the Nix expression expr.--file,-ffile β Interpret installables as attribute paths relative to the Nix expression stored in file. If file is the character-, then a Nix expression is read from standard input. Implies--impure.--no-recursiveβ Apply operation to specified paths only.
Note: See man nix.conf for overriding configuration settings with command line flags.
And that's the whole page bestie, you ate it, no cap. π This was nix3-copy(1) from the General Commands Manual β so go copy some closures, main character energy only, and remember: the interface is experimental so vibe check your flags every update. π«Άβ¨πΈ
π¦ 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