nixpkgs/nixos/tests/env.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.0 KiB
Nix
Raw Normal View History

2019-12-06 07:18:47 +00:00
import ./make-test-python.nix ({ pkgs, ...} : {
2017-09-06 00:05:37 +01:00
name = "environment";
meta = with pkgs.lib.maintainers; {
2017-09-06 00:05:37 +01:00
maintainers = [ nequissimus ];
};
2022-03-20 23:15:30 +00:00
nodes.machine = { pkgs, ... }:
2017-09-06 00:05:37 +01:00
{
boot.kernelPackages = pkgs.linuxPackages;
2019-08-13 22:52:01 +01:00
environment.etc.plainFile.text = ''
2017-09-06 00:05:37 +01: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 07:18:47 +00: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 00:05:37 +01:00
2019-12-06 07:18:47 +00:00
assert "/run/current-system/sw/share/terminfo" in machine.succeed(
"echo ''${TERMINFO_DIRS}"
)
assert "awesome" in machine.succeed("echo ''${NIXCON}")
'';
2017-09-06 00:05:37 +01:00
})