Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into HEAD
- Loading branch information
Showing
70 changed files
with
1,478 additions
and
248 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This test runs docker and checks if simple container starts | ||
|
||
import ./make-test.nix ({ pkgs, ...} : { | ||
name = "docker"; | ||
meta = with pkgs.stdenv.lib.maintainers; { | ||
maintainers = [ nequissimus offline ]; | ||
}; | ||
|
||
nodes = { | ||
docker = | ||
{ config, pkgs, ... }: | ||
{ | ||
virtualisation.docker.enable = true; | ||
virtualisation.docker.package = pkgs.docker-edge; | ||
|
||
users.users = { | ||
noprivs = { | ||
isNormalUser = true; | ||
description = "Can't access the docker daemon"; | ||
password = "foobar"; | ||
}; | ||
|
||
hasprivs = { | ||
isNormalUser = true; | ||
description = "Can access the docker daemon"; | ||
password = "foobar"; | ||
extraGroups = [ "docker" ]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
testScript = '' | ||
startAll; | ||
$docker->waitForUnit("sockets.target"); | ||
$docker->succeed("tar cv --files-from /dev/null | docker import - scratchimg"); | ||
$docker->succeed("docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"); | ||
$docker->succeed("docker ps | grep sleeping"); | ||
$docker->succeed("sudo -u hasprivs docker ps"); | ||
$docker->fail("sudo -u noprivs docker ps"); | ||
$docker->succeed("docker stop sleeping"); | ||
# Must match version twice to ensure client and server versions are correct | ||
$docker->succeed('[ $(docker version | grep ${pkgs.docker-edge.version} | wc -l) = "2" ]'); | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"'); | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import ./make-test.nix ({ pkgs, ...} : { | ||
name = "kernel-params"; | ||
meta = with pkgs.stdenv.lib.maintainers; { | ||
maintainers = [ nequissimus ]; | ||
}; | ||
|
||
machine = { config, lib, pkgs, ... }: | ||
{ | ||
boot.kernelPackages = pkgs.linuxPackages; | ||
boot.kernelParams = [ | ||
"nohibernate" | ||
"page_poison=1" | ||
"vsyscall=none" | ||
]; | ||
}; | ||
|
||
testScript = | ||
'' | ||
$machine->fail("cat /proc/cmdline | grep page_poison=0"); | ||
$machine->succeed("cat /proc/cmdline | grep nohibernate"); | ||
$machine->succeed("cat /proc/cmdline | grep page_poison=1"); | ||
$machine->succeed("cat /proc/cmdline | grep vsyscall=none"); | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import ./make-test.nix ({ pkgs, ...} : { | ||
name = "sysctl"; | ||
meta = with pkgs.stdenv.lib.maintainers; { | ||
maintainers = [ nequissimus ]; | ||
}; | ||
|
||
machine = { config, lib, pkgs, ... }: | ||
{ | ||
boot.kernelPackages = pkgs.linuxPackages; | ||
boot.kernel.sysctl = { | ||
"kernel.dmesg_restrict" = true; # Restrict dmesg access | ||
"net.core.bpf_jit_enable" = false; # Turn off bpf JIT | ||
"user.max_user_namespaces" = 0; # Disable user namespaces | ||
"vm.swappiness" = 2; # Low swap usage | ||
}; | ||
}; | ||
|
||
testScript = | ||
'' | ||
$machine->succeed("sysctl kernel.dmesg_restrict | grep 'kernel.dmesg_restrict = 1'"); | ||
$machine->succeed("sysctl net.core.bpf_jit_enable | grep 'net.core.bpf_jit_enable = 0'"); | ||
$machine->succeed("sysctl user.max_user_namespaces | grep 'user.max_user_namespaces = 0'"); | ||
$machine->succeed("sysctl vm.swappiness | grep 'vm.swappiness = 2'"); | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ./make-test.nix ({ pkgs, ...} : { | ||
name = "xmonad"; | ||
meta = with pkgs.stdenv.lib.maintainers; { | ||
maintainers = [ nequissimus ]; | ||
}; | ||
|
||
machine = { lib, pkgs, ... }: { | ||
imports = [ ./common/x11.nix ./common/user-account.nix ]; | ||
services.xserver.displayManager.auto.user = "alice"; | ||
services.xserver.windowManager.default = lib.mkForce "xmonad"; | ||
services.xserver.windowManager.xmonad = { | ||
enable = true; | ||
enableContribAndExtras = true; | ||
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ]; | ||
}; | ||
}; | ||
|
||
testScript = { nodes, ... }: '' | ||
$machine->waitForX; | ||
$machine->waitForFile("/home/alice/.Xauthority"); | ||
$machine->succeed("xauth merge ~alice/.Xauthority"); | ||
$machine->sleep(3); | ||
$machine->sendKeys("alt-shift-ret"); | ||
$machine->waitForWindow(qr/machine.*alice/); | ||
$machine->sleep(1); | ||
$machine->screenshot("terminal"); | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.