nix-super/doc/manual/source/command-ref/nix-store/import.md
John Ericson eb7d7780b1 Rename doc/manual{src -> source}
This is needed to avoid this
https://github.com/mesonbuild/meson/issues/13774 when we go back to
making our subproject directory `src`.
2024-10-14 11:21:24 -04:00

1.4 KiB
Raw Blame History

Name

nix-store --import - import Nix Archive into the store

Synopsis

nix-store --import

Description

The operation --import reads a serialisation of a set of store objects produced by nix-store --export from standard input, and adds those store objects to the specified Nix store. Paths that already exist in the target Nix store are ignored. If a path refers to another path that doesnt exist in the target Nix store, the import fails.

Note

For efficient transfer of closures to remote machines over SSH, use nix-copy-closure.

{{#include ./opt-common.md}}

{{#include ../opt-common.md}}

{{#include ../env-common.md}}

Examples

Example

Given a closure of GNU Hello as a file:

$ storePath="$(nix-build '<nixpkgs>' -I nixpkgs=channel:nixpkgs-unstable -A hello --no-out-link)"
$ nix-store --export $(nix-store --query --requisites $storePath) > hello.closure

Import the closure into a remote SSH store using the --store option:

$ nix-store --import --store ssh://alice@itchy.example.org < hello.closure