From f02f27cbcacfa23d9d3c8ab3125078248a8d202e Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 5 Jul 2022 10:12:54 +0200 Subject: [PATCH 1/4] lib/make-test: fix `system.stateVersion` warning --- test/lib/make-test.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/lib/make-test.nix b/test/lib/make-test.nix index 36782e7..6bd52be 100644 --- a/test/lib/make-test.nix +++ b/test/lib/make-test.nix @@ -64,7 +64,7 @@ name: testConfig: # This allows running a test scenario in a regular NixOS VM. # No tests are executed. - vmWithoutTests = (pkgs.nixos { + vmWithoutTests = (pkgs.nixos ({ config, ... }: { imports = [ testConfig "${toString pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix" @@ -78,7 +78,9 @@ name: testConfig: echo o >/proc/sysrq-trigger '')) ]; - }).vm; + + system.stateVersion = config.system.nixos.release; + })).config.system.build.vm; config = testConfig; } From a8255d61d711af06d019e1859fe3cb103a3a16ed Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 5 Jul 2022 10:12:55 +0200 Subject: [PATCH 2/4] lib/make-container: update required extra-container version --- test/lib/make-container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/make-container.sh b/test/lib/make-container.sh index 845cbc4..89944b5 100755 --- a/test/lib/make-container.sh +++ b/test/lib/make-container.sh @@ -77,8 +77,8 @@ while [[ $# > 0 ]]; do done containerBin=$(type -P extra-container) || true -if [[ ! ($containerBin && $(realpath $containerBin) == *extra-container-0.8*) ]]; then - echo "Building extra-container. Skip this step by adding extra-container 0.8 to PATH." +if [[ ! ($containerBin && $(realpath $containerBin) == *extra-container-0.10*) ]]; then + echo "Building extra-container. Skip this step by adding extra-container 0.10 to PATH." nix-build --out-link /tmp/extra-container "$scriptDir"/../pkgs \ -A pinned.extra-container >/dev/null export PATH="/tmp/extra-container/bin${PATH:+:}$PATH" From 2ae2eea54e127310612bf0f9fadf269b584eec98 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 5 Jul 2022 10:12:56 +0200 Subject: [PATCH 3/4] run-tests: fix command `debug` on NixOS 22.05 --- test/run-tests.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/run-tests.sh b/test/run-tests.sh index e63a823..589fa94 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -135,15 +135,17 @@ run() { echo "Running interactive testing environment" tests=$( echo 'is_interactive = True' - echo 'exec(os.environ["testScript"])' + echo 'exec(open(os.environ["testScript"]).read())' # Start VM 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 'code.interact(local=globals())' ) else - tests='exec(os.environ["testScript"])' + tests='exec(open(os.environ["testScript"]).read())' fi echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB" @@ -154,10 +156,9 @@ run() { TMPDIR="$TMPDIR" \ USE_TMPDIR=1 \ NIX_DISK_IMAGE=$TMPDIR/img.qcow2 \ - tests="$tests" \ QEMU_OPTS="-smp $numCPUs -m $memoryMiB -nographic $QEMU_OPTS" \ QEMU_NET_OPTS="$QEMU_NET_OPTS" \ - $TMPDIR/driver/bin/nixos-test-driver + $TMPDIR/driver/bin/nixos-test-driver <(echo "$tests") } debug() { From 7261813051c0ea92c603570c21ddd8a680facace Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 5 Jul 2022 10:12:57 +0200 Subject: [PATCH 4/4] examples/configuration.nix: use `system.stateVersion` comment from NixOS 22.05 --- examples/configuration.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/configuration.nix b/examples/configuration.nix index bb36d07..0b5ccd7 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -270,10 +270,12 @@ # FIXME: Add custom options (like boot options, output of # nixos-generate-config, etc.): - # This value determines the NixOS release with which your system is to be - # compatible, in order to avoid breaking some software such as database - # servers. You should change this only after NixOS release notes say you - # should. + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # 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? # The nix-bitcoin release version that your config is compatible with.