nix3-store...addressable(1)

πŸ“¦ version 2.6.0, in ubuntu jammy

πŸ’… nix3-store...addressable(1) β€” General Commands Manual

okay bestie, welcome to the manual page for nix store make-content-addressable, straight outta the General Commands Manual ✨

⚠️ Warning: this program is experimental and its interface is subject to change. no cap. it might glow up and change on you, so don't get too attached to the exact flags, okay? 😭

🌸 Name

nix store make-content-addressable β€” rewrite a path or closure to content-addressed form πŸŽ€


✨ Synopsis

nix store make-content-addressable [option…] installables…

πŸ¦‹ Examples

  • Create a content-addressed representation of the closure of GNU Hello:
# nix store make-content-addressable -r nixpkgs#hello
…
rewrote '/nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10' to '/nix/store/5skmmcb9svys5lj3kbsrjg7vf2irid63-hello-2.10'

Since the resulting paths are content-addressed, they are always trusted and don’t need signatures to copied to another store:

# nix copy --to /tmp/nix --trusted-public-keys '' /nix/store/5skmmcb9svys5lj3kbsrjg7vf2irid63-hello-2.10

By contrast, the original closure is input-addressed, so it does need signatures to be trusted:

# nix copy --to /tmp/nix --trusted-public-keys '' nixpkgs#hello
cannot add path '/nix/store/zy9wbxwcygrwnh8n2w9qbbcr6zk87m26-libunistring-0.9.10' because it lacks a valid signature
  • Create a content-addressed representation of the current NixOS system closure:
# nix store make-content-addressable -r /run/current-system

πŸ’– Description

This command converts the closure of the store paths you name in installables into content-addressed form. here's the tea: Nix store paths are usually input-addressed, which means the hash part of the store path gets computed from the contents of the derivation (aka the build-time dependency graph). and input-addressed paths need to be signed by a trusted key if you wanna import them into a store, because we have to trust that the contents of the path were actually built by that derivation. it's giving "trust me bro" energy, and Nix is not about that life πŸ™ˆ

By contrast, in a content-addressed path, the hash part is computed from the contents of the path itself. so the contents can be verified with zero extra info β€” no signatures, no receipts, nothing. which means a command like this:

# nix store build /nix/store/5skmmcb9svys5lj3kbsrjg7vf2irid63-hello-2.10 \
    --substituters https://my-cache.example.org

will succeed even if the binary cache https://my-cache.example.org doesn’t present any signatures. slay. iconic. that's the whole point πŸ’…


πŸ‘‘ Options

  • --json β€” produce output in JSON format, suitable for consumption by another program. for when a human isn't the one reading it 🫢

🧚 Common evaluation options

  • --arg name expr β€” pass the value expr as the argument name to Nix functions.
  • --argstr name string β€” pass the string string as the argument name to Nix functions.
  • --eval-store store-url β€” the Nix store to use for evaluations.
  • --impure β€” allow access to mutable paths and repositories. living dangerously, love that for you ✨
  • --include / -I path β€” add path to the list of locations used to look up <...> file names.
  • --override-flake original-ref resolved-ref β€” override the flake registries, redirecting original-ref to resolved-ref.
  • --commit-lock-file β€” commit changes to the flake’s lock file.
  • --inputs-from flake-url β€” use the inputs of the specified flake as registry entries.
  • --no-registries β€” don’t allow lookups in the flake registries. This option is deprecated; use --no-use-registries. girl, it's over, move on πŸ’€
  • --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.
  • --override-input input-path flake-url β€” override a specific flake input (e.g. dwarffs/nixpkgs). this implies --no-write-lock-file.
  • --recreate-lock-file β€” recreate the flake’s lock file from scratch.
  • --update-input input-path β€” update a specific flake input (ignoring its previous entry in the lock file).

⭐ Options that change the interpretation of installables

  • --all β€” apply the operation to every store path. all of them. every single one. periodt.
  • --derivation β€” operate on the store derivation rather than its outputs.
  • --expr expr β€” interpret installables as attribute paths relative to the Nix expression expr.
  • --file / -f file β€” interpret installables as attribute paths relative to the Nix expression stored in file.
  • --recursive / -r β€” apply operation to closure of the specified paths. the closure!! we love a closure πŸ’–

that's the whole page bestie, hope you ate πŸ“ this was the nix3-store...addressable(1) page from the General Commands Manual β€” go forth and make things content-addressed, you've got this πŸŽ€βœ¨

πŸ“¦ where this page comes from