summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/binfmt.nix10
-rw-r--r--nixos/tests/chromium.nix36
-rw-r--r--nixos/tests/cifs-utils.nix12
-rw-r--r--nixos/tests/opentabletdriver.nix13
-rw-r--r--nixos/tests/podman.nix15
5 files changed, 72 insertions, 14 deletions
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix
index 9eeae0c3ef44..5bcc95be324a 100644
--- a/nixos/modules/system/boot/binfmt.nix
+++ b/nixos/modules/system/boot/binfmt.nix
@@ -20,8 +20,14 @@ let
optionalString fixBinary "F";
in ":${name}:${type}:${offset'}:${magicOrExtension}:${mask'}:${interpreter}:${flags}";
- activationSnippet = name: { interpreter, ... }:
- "ln -sf ${interpreter} /run/binfmt/${name}";
+ activationSnippet = name: { interpreter, ... }: ''
+ rm -f /run/binfmt/${name}
+ cat > /run/binfmt/${name} << 'EOF'
+ #!/usr/bin/env sh
+ exec -- ${interpreter} "$@"
+ EOF
+ chmod +x /run/binfmt/${name}
+ '';
getEmulator = system: (lib.systems.elaborate { inherit system; }).emulator pkgs;
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index d4085bebac0f..4d6b726d9e4c 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -1,10 +1,14 @@
{ system ? builtins.currentSystem
, config ? {}
, pkgs ? import ../.. { inherit system config; }
-, channelMap ? {
- stable = pkgs.chromium;
- beta = pkgs.chromiumBeta;
- dev = pkgs.chromiumDev;
+, channelMap ? { # Maps "channels" to packages
+ stable = pkgs.chromium;
+ beta = pkgs.chromiumBeta;
+ dev = pkgs.chromiumDev;
+ ungoogled = pkgs.ungoogled-chromium;
+ chrome-stable = pkgs.google-chrome;
+ chrome-beta = pkgs.google-chrome-beta;
+ chrome-dev = pkgs.google-chrome-dev;
}
}:
@@ -14,7 +18,7 @@ with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec {
name = "chromium-${channel}";
meta = {
- maintainers = with maintainers; [ aszlig ];
+ maintainers = with maintainers; [ aszlig primeos ];
# https://github.com/NixOS/hydra/issues/591#issuecomment-435125621
inherit (chromiumPkg.meta) timeout;
};
@@ -58,6 +62,19 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
return "su - ${user} -c " + shlex.quote(cmd)
+ def get_browser_binary():
+ """Returns the name of the browser binary."""
+ pname = "${getName chromiumPkg.name}"
+ if pname.find("chromium") != -1:
+ return "chromium" # Same name for all channels and ungoogled-chromium
+ if pname == "google-chrome":
+ return "google-chrome-stable"
+ if pname == "google-chrome-dev":
+ return "google-chrome-unstable"
+ # For google-chrome-beta and as fallback:
+ return pname
+
+
def create_new_win():
with machine.nested("Creating a new Chromium window"):
machine.execute(
@@ -153,7 +170,14 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
machine.wait_for_x()
url = "file://${startupHTML}"
- machine.succeed(ru(f'ulimit -c unlimited; chromium "{url}" & disown'))
+ machine.succeed(ru(f'ulimit -c unlimited; "{get_browser_binary()}" "{url}" & disown'))
+
+ if get_browser_binary().startswith("google-chrome"):
+ # Need to click away the first window:
+ machine.wait_for_text("Make Google Chrome the default browser")
+ machine.screenshot("google_chrome_default_browser_prompt")
+ machine.send_key("ret")
+
machine.wait_for_text("startup done")
machine.wait_until_succeeds(
ru(
diff --git a/nixos/tests/cifs-utils.nix b/nixos/tests/cifs-utils.nix
new file mode 100644
index 000000000000..98587b10d941
--- /dev/null
+++ b/nixos/tests/cifs-utils.nix
@@ -0,0 +1,12 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+ name = "cifs-utils";
+
+ machine = { pkgs, ... }: { environment.systemPackages = [ pkgs.cifs-utils ]; };
+
+ testScript = ''
+ machine.succeed("smbinfo -h")
+ machine.succeed("smb2-quota -h")
+ assert "${pkgs.cifs-utils.version}" in machine.succeed("cifs.upcall -v")
+ assert "${pkgs.cifs-utils.version}" in machine.succeed("mount.cifs -V")
+ '';
+})
diff --git a/nixos/tests/opentabletdriver.nix b/nixos/tests/opentabletdriver.nix
index 832d4c25a540..fe345a7bec73 100644
--- a/nixos/tests/opentabletdriver.nix
+++ b/nixos/tests/opentabletdriver.nix
@@ -1,4 +1,6 @@
-import ./make-test-python.nix ( { pkgs, ... }: {
+import ./make-test-python.nix ( { pkgs, ... }: let
+ testUser = "alice";
+in {
name = "opentabletdriver";
meta = {
maintainers = with pkgs.lib.maintainers; [ thiagokokada ];
@@ -10,7 +12,7 @@ import ./make-test-python.nix ( { pkgs, ... }: {
./common/user-account.nix
./common/x11.nix
];
- test-support.displayManager.auto.user = "alice";
+ test-support.displayManager.auto.user = testUser;
hardware.opentabletdriver.enable = true;
};
@@ -18,10 +20,11 @@ import ./make-test-python.nix ( { pkgs, ... }: {
''
machine.start()
machine.wait_for_x()
- machine.wait_for_unit("opentabletdriver.service", "alice")
+ machine.wait_for_unit("opentabletdriver.service", "${testUser}")
- machine.succeed("cat /etc/udev/rules.d/30-opentabletdriver.rules")
+ machine.succeed("cat /etc/udev/rules.d/99-opentabletdriver.rules")
# Will fail if service is not running
- machine.succeed("otd detect")
+ # Needs to run as the same user that started the service
+ machine.succeed("su - ${testUser} -c 'otd detect'")
'';
})
diff --git a/nixos/tests/podman.nix b/nixos/tests/podman.nix
index bccd2de7c9b9..4985ff60365c 100644
--- a/nixos/tests/podman.nix
+++ b/nixos/tests/podman.nix
@@ -61,6 +61,20 @@ import ./make-test-python.nix (
podman.succeed("podman stop sleeping")
podman.succeed("podman rm sleeping")
+ # create systemd session for rootless
+ podman.succeed("loginctl enable-linger alice")
+
+ with subtest("Run container rootless with runc"):
+ podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
+ podman.succeed(
+ su_cmd(
+ "podman run --runtime=runc -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
+ )
+ )
+ podman.succeed(su_cmd("podman ps | grep sleeping"))
+ podman.succeed(su_cmd("podman stop sleeping"))
+ podman.succeed(su_cmd("podman rm sleeping"))
+
with subtest("Run container rootless with crun"):
podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
podman.succeed(
@@ -71,7 +85,6 @@ import ./make-test-python.nix (
podman.succeed(su_cmd("podman ps | grep sleeping"))
podman.succeed(su_cmd("podman stop sleeping"))
podman.succeed(su_cmd("podman rm sleeping"))
- # As of 2020-11-20, the runc backend doesn't work with cgroupsv2 yet, so we don't run that test.
with subtest("Run container rootless with the default backend"):
podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))