nixpkgs/nixos/tests/env.nix

37 lines
1.0 KiB
Nix
Raw Normal View History

2019-12-06 10:18:47 +03:00
import ./make-test-python.nix ({ pkgs, ...} : {
2017-09-06 02:05:37 +03:00
name = "environment";
meta = with pkgs.lib.maintainers; {
2017-09-06 02:05:37 +03:00
maintainers = [ nequissimus ];
};
machine = { pkgs, ... }:
2017-09-06 02:05:37 +03:00
{
boot.kernelPackages = pkgs.linuxPackages;
2019-08-14 00:52:01 +03:00
environment.etc.plainFile.text = ''
2017-09-06 02:05:37 +03:00
Hello World
'';
environment.etc."folder/with/file".text = ''
Foo Bar!
'';
environment.sessionVariables = {
TERMINFO_DIRS = "/run/current-system/sw/share/terminfo";
NIXCON = "awesome";
};
};
2019-12-06 10:18:47 +03:00
testScript = ''
machine.succeed('[ -L "/etc/plainFile" ]')
assert "Hello World" in machine.succeed('cat "/etc/plainFile"')
machine.succeed('[ -d "/etc/folder" ]')
machine.succeed('[ -d "/etc/folder/with" ]')
machine.succeed('[ -L "/etc/folder/with/file" ]')
assert "Hello World" in machine.succeed('cat "/etc/plainFile"')
2017-09-06 02:05:37 +03:00
2019-12-06 10:18:47 +03:00
assert "/run/current-system/sw/share/terminfo" in machine.succeed(
"echo ''${TERMINFO_DIRS}"
)
assert "awesome" in machine.succeed("echo ''${NIXCON}")
'';
2017-09-06 02:05:37 +03:00
})