1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 11:43:15 +02:00

New store settings system

Motivation:

See the linked issues for details.

The most notable user-relevant bits are:

- This cleans up the `MountedSSHStore`: decomposed into its orthogonal parts

- This brings us pretty close to being able to then implement a JSON-based config.
   - Store query parameters can be JSON
   - Stores can entirely be specified via JSON objects, but this is not yet hooked up to anything.

Also behind the scenes have these benefits:

1. The docs are moved out of the headers, good for less rebuilding when they changes
2. Stores are always constructed from store configs
3. Use JSON, avoid custom serializers

Context:

Part of #11106

Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
Co-authored-by: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com>
This commit is contained in:
John Ericson 2025-03-17 11:29:06 -04:00
parent bf5d544d3b
commit 2ea9f59978
69 changed files with 2062 additions and 701 deletions

View file

@ -5,17 +5,25 @@ source common.sh
requireSandboxSupport
[[ $busybox =~ busybox ]] || skipTest "no busybox"
# An example of a command that uses the store only for its settings, to
# make sure we catch needing the XP feature early.
touch "$TEST_ROOT/foo"
expectStderr 1 nix --store 'ssh-ng://localhost?mounted=%7B%7D' store add "$TEST_ROOT/foo" --dry-run | grepQuiet "experimental Nix feature 'mounted-ssh-store' is disabled"
enableFeatures mounted-ssh-store
# N.B. encoded query param is `mounted={}`. In the future, we can just
# do `--store` with JSON, and then the nested structure will actually
# bring benefits.
nix build -Lvf simple.nix \
--arg busybox "$busybox" \
--out-link "$TEST_ROOT/result-from-remote" \
--store mounted-ssh-ng://localhost
--store 'ssh-ng://localhost?mounted=%7B%7D'
nix build -Lvf simple.nix \
--arg busybox "$busybox" \
--out-link "$TEST_ROOT/result-from-remote-new-cli" \
--store 'mounted-ssh-ng://localhost?remote-program=nix daemon'
--store 'ssh-ng://localhost?mounted=%7B%7D&remote-program=nix daemon'
# This verifies that the out link was actually created and valid. The ability
# to create out links (permanent gc roots) is the distinguishing feature of