diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index f820c0408017..4cc140ebb155 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -82,6 +82,7 @@ in rec { (all nixos.tests.boot-stage1) nixos.tests.hibernate.x86_64-linux # i686 is flaky, see #23107 (all nixos.tests.ecryptfs) + (all nixos.tests.env) (all nixos.tests.ipv6) (all nixos.tests.i3wm) (all nixos.tests.keymap.azerty) diff --git a/nixos/release.nix b/nixos/release.nix index 6348c2f15d4c..bad9cfe6c7e9 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -240,6 +240,7 @@ in rec { tests.ec2-nixops = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-nixops; tests.ec2-config = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-config; tests.elk = callTest tests/elk.nix {}; + tests.env = callTest tests/env.nix {}; tests.ferm = callTest tests/ferm.nix {}; tests.firefox = callTest tests/firefox.nix {}; tests.firewall = callTest tests/firewall.nix {}; diff --git a/nixos/tests/env.nix b/nixos/tests/env.nix new file mode 100644 index 000000000000..c6b0424e97b9 --- /dev/null +++ b/nixos/tests/env.nix @@ -0,0 +1,35 @@ +import ./make-test.nix ({ pkgs, ...} : { + name = "environment"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + machine = { config, lib, pkgs, ... }: + { + boot.kernelPackages = pkgs.linuxPackages; + environment.etc."plainFile".text = '' + Hello World + ''; + environment.etc."folder/with/file".text = '' + Foo Bar! + ''; + + environment.sessionVariables = { + TERMINFO_DIRS = "/run/current-system/sw/share/terminfo"; + NIXCON = "awesome"; + }; + }; + + testScript = + '' + $machine->succeed('[ -L "/etc/plainFile" ]'); + $machine->succeed('cat "/etc/plainFile" | grep "Hello World"'); + $machine->succeed('[ -d "/etc/folder" ]'); + $machine->succeed('[ -d "/etc/folder/with" ]'); + $machine->succeed('[ -L "/etc/folder/with/file" ]'); + $machine->succeed('cat "/etc/plainFile" | grep "Hello World"'); + + $machine->succeed('echo ''${TERMINFO_DIRS} | grep "/run/current-system/sw/share/terminfo"'); + $machine->succeed('echo ''${NIXCON} | grep "awesome"'); + ''; +})