nixpkgs-suyu/nixos/tests/env.nix

37 lines
1 KiB
Nix
Raw Normal View History

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