mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
25bef2d8f9
The library does not depend on stdenv, that `stdenv` exposes `lib` is an artifact of the ancient origins of nixpkgs.
38 lines
1,014 B
Nix
38 lines
1,014 B
Nix
# Test configuration switching.
|
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
name = "switch-test";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ gleber ];
|
|
};
|
|
|
|
nodes = {
|
|
machine = { ... }: {
|
|
users.mutableUsers = false;
|
|
};
|
|
other = { ... }: {
|
|
users.mutableUsers = true;
|
|
};
|
|
};
|
|
|
|
testScript = {nodes, ...}: let
|
|
originalSystem = nodes.machine.config.system.build.toplevel;
|
|
otherSystem = nodes.other.config.system.build.toplevel;
|
|
|
|
# Ensures failures pass through using pipefail, otherwise failing to
|
|
# switch-to-configuration is hidden by the success of `tee`.
|
|
stderrRunner = pkgs.writeScript "stderr-runner" ''
|
|
#! ${pkgs.runtimeShell}
|
|
set -e
|
|
set -o pipefail
|
|
exec env -i "$@" | tee /dev/stderr
|
|
'';
|
|
in ''
|
|
machine.succeed(
|
|
"${stderrRunner} ${originalSystem}/bin/switch-to-configuration test"
|
|
)
|
|
machine.succeed(
|
|
"${stderrRunner} ${otherSystem}/bin/switch-to-configuration test"
|
|
)
|
|
'';
|
|
})
|