1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00
nix/tests/functional/build-remote-with-mounted-ssh-ng.sh
John Ericson fe8b42df23 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>
2025-05-23 16:49:57 -04:00

32 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
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 'ssh-ng://localhost?mounted=%7B%7D'
nix build -Lvf simple.nix \
--arg busybox "$busybox" \
--out-link "$TEST_ROOT/result-from-remote-new-cli" \
--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
# the mounted-ssh-ng store.
grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote/hello"
grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote-new-cli/hello"