mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Merge pull request #10711 from fricklerhandwerk/nix-store-export-example
make a more relevant example for `nix-store --export`
This commit is contained in:
commit
7cb3c80bb5
1 changed files with 18 additions and 12 deletions
|
@ -29,15 +29,21 @@ Nix store, the import will fail.
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
To copy a whole closure, do something
|
> **Example**
|
||||||
like:
|
>
|
||||||
|
> Deploy GNU Hello to an airgapped machine via USB stick.
|
||||||
```console
|
>
|
||||||
$ nix-store --export $(nix-store --query --requisites paths) > out
|
> Write the closure to the block device on a machine with internet connection:
|
||||||
```
|
>
|
||||||
|
> ```shell-session
|
||||||
To import the whole closure again, run:
|
> [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
|
||||||
```console
|
> ```
|
||||||
$ nix-store --import < out
|
>
|
||||||
```
|
> Read the closure from the block device on the machine without internet connection:
|
||||||
|
>
|
||||||
|
> ```shell-session
|
||||||
|
> [bob@scratchy]$ hello=$(sudo dd if=/dev/usb | nix-store --import | tail -1)
|
||||||
|
> [bob@scratchy]$ $hello/bin/hello
|
||||||
|
> Hello, world!
|
||||||
|
> ```
|
||||||
|
|
Loading…
Reference in a new issue