nix-store-export(1)

nix-store-export1

Export store paths to a nix archive ⟨@docroot@/store/file-system-object/content-address.md#serial-nix-archive⟩

Examples

Example

Deploy GNU Hello to an airgapped machine via USB stick.

Write the closure to the block device on a machine with internet connection:

[alice@itchy]$ storePath=$(nix-build '<nixpkgs>' -I nixpkgs=channel:nixpkgs-unstable -A hello --no-out-link)
[alice@itchy]$ nix-store --export $(nix-store --query --requisites $storePath) | sudo dd of=/dev/usb

Read the closure from the block device on the machine without internet connection:

[bob@scratchy]$ hello=$(sudo dd if=/dev/usb | nix-store --import | tail -1)
[bob@scratchy]$ $hello/bin/hello
Hello, world!

From nix-bin 2.26.3+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.