1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 14:32:45 -04:00
nix/doc/manual/src/command-ref/nix-store/realise.md
2023-08-31 21:26:15 +02:00

3.3 KiB
Raw Blame History

Name

nix-store --realise - realise specified store paths

Synopsis

nix-store {--realise | -r} paths… [--dry-run]

Description

Each of paths is processed as follows:

  • If the path is already valid, do nothing.
  • If the path leads to a store derivation:
    1. Realise the store derivation file itself, as a regular store path.
    2. Realise its output paths:
    • Try to fetch from substituters the store objects associated with the output paths in the store derivation's closure.
    • For any store paths that cannot be substituted, produce the required store objects by first realising all outputs of the derivation's dependencies and then running the derivation's builder executable.
  • Otherwise: Try to fetch the associated store objects in the paths' closure from substituters.

If no substitutes are available and no store derivation is given, realisation fails.

The resulting paths are printed on standard output. For non-derivation arguments, the argument itself is printed.

{{#include ../status-build-failure.md}}

Options

  • --dry-run
    Print on standard error a description of what packages would be built or downloaded, without actually performing the operation.

  • --ignore-unknown
    If a non-derivation path does not have a substitute, then silently ignore it.

  • --check
    This option allows you to check whether a derivation is deterministic. It rebuilds the specified derivation and checks whether the result is bitwise-identical with the existing outputs, printing an error if thats not the case. The outputs of the specified derivation must already exist. When used with -K, if an output path is not identical to the corresponding output from the previous build, the new output path is left in /nix/store/name.check.

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

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

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

Examples

This operation is typically used to build store derivations produced by nix-instantiate:

$ nix-store --realise $(nix-instantiate ./test.nix)
/nix/store/31axcgrlbfsxzmfff1gyj1bf62hvkby2-aterm-2.3.1

This is essentially what nix-build does.

To test whether a previously-built derivation is deterministic:

$ nix-build '<nixpkgs>' --attr hello --check -K

Use nix-store --read-log to show the stderr and stdout of a build:

$ nix-store --read-log $(nix-instantiate ./test.nix)