Merge fort-nix/nix-bitcoin#508: More NixOS 22.05 fixes

7261813051 examples/configuration.nix: use `system.stateVersion` comment from NixOS 22.05 (Erik Arvstedt)
2ae2eea54e run-tests: fix command `debug` on NixOS 22.05 (Erik Arvstedt)
a8255d61d7 lib/make-container: update required extra-container version (Erik Arvstedt)
f02f27cbca lib/make-test: fix `system.stateVersion` warning (Erik Arvstedt)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 7261813051

Tree-SHA512: ae6d15092666187dfb9eca6a307ee2533446e49265390315b74d00b848b072339e522308ed88751d09631cc064c0f7fd34084add38ca52c130153a4ebc527549
This commit is contained in:
Jonas Nick 2022-07-05 10:12:09 +00:00
commit 739fa36785
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
4 changed files with 18 additions and 13 deletions

View File

@ -270,10 +270,12 @@
# FIXME: Add custom options (like boot options, output of # FIXME: Add custom options (like boot options, output of
# nixos-generate-config, etc.): # nixos-generate-config, etc.):
# This value determines the NixOS release with which your system is to be # This value determines the NixOS release from which the default
# compatible, in order to avoid breaking some software such as database # settings for stateful data, like file locations and database versions
# servers. You should change this only after NixOS release notes say you # on your system were taken. It's perfectly fine and recommended to leave
# should. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment? system.stateVersion = "22.05"; # Did you read the comment?
# The nix-bitcoin release version that your config is compatible with. # The nix-bitcoin release version that your config is compatible with.

View File

@ -77,8 +77,8 @@ while [[ $# > 0 ]]; do
done done
containerBin=$(type -P extra-container) || true containerBin=$(type -P extra-container) || true
if [[ ! ($containerBin && $(realpath $containerBin) == *extra-container-0.8*) ]]; then if [[ ! ($containerBin && $(realpath $containerBin) == *extra-container-0.10*) ]]; then
echo "Building extra-container. Skip this step by adding extra-container 0.8 to PATH." echo "Building extra-container. Skip this step by adding extra-container 0.10 to PATH."
nix-build --out-link /tmp/extra-container "$scriptDir"/../pkgs \ nix-build --out-link /tmp/extra-container "$scriptDir"/../pkgs \
-A pinned.extra-container >/dev/null -A pinned.extra-container >/dev/null
export PATH="/tmp/extra-container/bin${PATH:+:}$PATH" export PATH="/tmp/extra-container/bin${PATH:+:}$PATH"

View File

@ -64,7 +64,7 @@ name: testConfig:
# This allows running a test scenario in a regular NixOS VM. # This allows running a test scenario in a regular NixOS VM.
# No tests are executed. # No tests are executed.
vmWithoutTests = (pkgs.nixos { vmWithoutTests = (pkgs.nixos ({ config, ... }: {
imports = [ imports = [
testConfig testConfig
"${toString pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix" "${toString pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix"
@ -78,7 +78,9 @@ name: testConfig:
echo o >/proc/sysrq-trigger echo o >/proc/sysrq-trigger
'')) ''))
]; ];
}).vm;
system.stateVersion = config.system.nixos.release;
})).config.system.build.vm;
config = testConfig; config = testConfig;
} }

View File

@ -135,15 +135,17 @@ run() {
echo "Running interactive testing environment" echo "Running interactive testing environment"
tests=$( tests=$(
echo 'is_interactive = True' echo 'is_interactive = True'
echo 'exec(os.environ["testScript"])' echo 'exec(open(os.environ["testScript"]).read())'
# Start VM # Start VM
echo 'start_all()' echo 'start_all()'
# Start REPL # Start REPL.
# Use `code.interact` for the REPL instead of the builtin test driver REPL
# because it supports low featured terminals like Emacs' shell-mode.
echo 'import code' echo 'import code'
echo 'code.interact(local=globals())' echo 'code.interact(local=globals())'
) )
else else
tests='exec(os.environ["testScript"])' tests='exec(open(os.environ["testScript"]).read())'
fi fi
echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB" echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB"
@ -154,10 +156,9 @@ run() {
TMPDIR="$TMPDIR" \ TMPDIR="$TMPDIR" \
USE_TMPDIR=1 \ USE_TMPDIR=1 \
NIX_DISK_IMAGE=$TMPDIR/img.qcow2 \ NIX_DISK_IMAGE=$TMPDIR/img.qcow2 \
tests="$tests" \
QEMU_OPTS="-smp $numCPUs -m $memoryMiB -nographic $QEMU_OPTS" \ QEMU_OPTS="-smp $numCPUs -m $memoryMiB -nographic $QEMU_OPTS" \
QEMU_NET_OPTS="$QEMU_NET_OPTS" \ QEMU_NET_OPTS="$QEMU_NET_OPTS" \
$TMPDIR/driver/bin/nixos-test-driver $TMPDIR/driver/bin/nixos-test-driver <(echo "$tests")
} }
debug() { debug() {