diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index dbfb793af023..07ddbf27b7d8 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -791,6 +791,11 @@ in leaps = runTest ./leaps.nix; lemmy = runTest ./lemmy.nix; libinput = runTest ./libinput.nix; + lemurs = runTest ./lemurs/lemurs.nix; + lemurs-wayland = runTest ./lemurs/lemurs-wayland.nix; + lemurs-wayland-script = runTest ./lemurs/lemurs-wayland-script.nix; + lemurs-xorg = runTest ./lemurs/lemurs-xorg.nix; + lemurs-xorg-script = runTest ./lemurs/lemurs-xorg-script.nix; librenms = runTest ./librenms.nix; libresprite = runTest ./libresprite.nix; libreswan = runTest ./libreswan.nix; diff --git a/nixos/tests/lemurs/lemurs-wayland-script.nix b/nixos/tests/lemurs/lemurs-wayland-script.nix new file mode 100644 index 000000000000..a8c32496885f --- /dev/null +++ b/nixos/tests/lemurs/lemurs-wayland-script.nix @@ -0,0 +1,50 @@ +{ lib, ... }: +{ + name = "lemurs-wayland-script"; + meta = with lib.maintainers; { + maintainers = [ + nullcube + stunkymonkey + ]; + }; + + nodes.machine = + { lib, config, ... }: + { + imports = [ ../common/user-account.nix ]; + + # Required for wayland to work with Lemurs + services.seatd.enable = true; + users.users.alice.extraGroups = [ "seat" ]; + + services.displayManager.lemurs.enable = true; + + programs.sway.enable = true; + environment.etc."lemurs/wayland/sway" = { + mode = "755"; + text = '' + #! /bin/sh + exec ${lib.getExe config.programs.sway.package} + ''; + }; + }; + + testScript = '' + machine.start() + + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'lemurs.*tty1'") + machine.screenshot("postboot") + + with subtest("Log in as alice to Sway"): + machine.send_chars("\n") + machine.send_chars("alice\n") + machine.sleep(1) + machine.send_chars("foobar\n") + machine.sleep(1) + machine.wait_until_succeeds("pgrep -u alice sway") + machine.sleep(10) + machine.succeed("pgrep -u alice sway") + machine.screenshot("postlogin") + ''; +} diff --git a/nixos/tests/lemurs/lemurs-wayland.nix b/nixos/tests/lemurs/lemurs-wayland.nix new file mode 100644 index 000000000000..1fede02cb61e --- /dev/null +++ b/nixos/tests/lemurs/lemurs-wayland.nix @@ -0,0 +1,43 @@ +{ lib, ... }: +{ + name = "lemurs-wayland"; + meta = with lib.maintainers; { + maintainers = [ + nullcube + stunkymonkey + ]; + }; + + nodes.machine = + { ... }: + { + imports = [ ../common/user-account.nix ]; + + # Required for wayland to work with Lemurs + services.seatd.enable = true; + users.users.alice.extraGroups = [ "seat" ]; + + services.displayManager.lemurs.enable = true; + + programs.river.enable = true; + }; + + testScript = '' + machine.start() + + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'lemurs.*tty1'") + machine.screenshot("postboot") + + with subtest("Log in as alice to river"): + machine.send_chars("\n") + machine.send_chars("alice\n") + machine.sleep(1) + machine.send_chars("foobar\n") + machine.sleep(1) + machine.wait_until_succeeds("pgrep -u alice river") + machine.sleep(10) + machine.succeed("pgrep -u alice river") + machine.screenshot("postlogin") + ''; +} diff --git a/nixos/tests/lemurs/lemurs-xorg-script.nix b/nixos/tests/lemurs/lemurs-xorg-script.nix new file mode 100644 index 000000000000..b64952a564be --- /dev/null +++ b/nixos/tests/lemurs/lemurs-xorg-script.nix @@ -0,0 +1,46 @@ +{ lib, ... }: +{ + name = "lemurs-xorg-script"; + meta = with lib.maintainers; { + maintainers = [ + nullcube + stunkymonkey + ]; + }; + + nodes.machine = + { pkgs, ... }: + { + imports = [ ../common/user-account.nix ]; + + services.displayManager.lemurs.enable = true; + + services.xserver.enable = true; + + environment.etc."lemurs/wms/icewm" = { + mode = "755"; + text = '' + #! /bin/sh + exec ${pkgs.icewm}/bin/icewm-session + ''; + }; + }; + + testScript = '' + machine.start() + + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'lemurs.*tty1'") + machine.screenshot("postboot") + + with subtest("Log in as alice to icewm"): + machine.send_chars("\n") + machine.send_chars("alice\n") + machine.sleep(1) + machine.send_chars("foobar\n") + machine.wait_until_succeeds("pgrep -u alice icewm") + machine.sleep(10) + machine.succeed("pgrep -u alice icewm") + machine.screenshot("postlogin") + ''; +} diff --git a/nixos/tests/lemurs/lemurs-xorg.nix b/nixos/tests/lemurs/lemurs-xorg.nix new file mode 100644 index 000000000000..8fa1ffe3f0c9 --- /dev/null +++ b/nixos/tests/lemurs/lemurs-xorg.nix @@ -0,0 +1,40 @@ +{ lib, ... }: +{ + name = "lemurs-xorg"; + meta = with lib.maintainers; { + maintainers = [ + nullcube + stunkymonkey + ]; + }; + + nodes.machine = + { ... }: + { + imports = [ ../common/user-account.nix ]; + + services.displayManager.lemurs.enable = true; + + services.xserver.enable = true; + + services.xserver.windowManager.icewm.enable = true; + }; + + testScript = '' + machine.start() + + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'lemurs.*tty1'") + machine.screenshot("postboot") + + with subtest("Log in as alice to icewm"): + machine.send_chars("\n") + machine.send_chars("alice\n") + machine.sleep(1) + machine.send_chars("foobar\n") + machine.wait_until_succeeds("pgrep -u alice icewm") + machine.sleep(10) + machine.succeed("pgrep -u alice icewm") + machine.screenshot("postlogin") + ''; +} diff --git a/nixos/tests/lemurs/lemurs.nix b/nixos/tests/lemurs/lemurs.nix new file mode 100644 index 000000000000..803f74bfc681 --- /dev/null +++ b/nixos/tests/lemurs/lemurs.nix @@ -0,0 +1,37 @@ +{ + lib, + ... +}: +{ + name = "lemurs"; + meta = with lib.maintainers; { + maintainers = [ + nullcube + stunkymonkey + ]; + }; + + nodes.machine = _: { + imports = [ ../common/user-account.nix ]; + services.displayManager.lemurs.enable = true; + }; + + testScript = '' + machine.start() + + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'lemurs.*tty1'") + machine.screenshot("postboot") + + with subtest("Log in as alice on a virtual console"): + machine.send_chars("\n") + machine.send_chars("alice\n") + machine.sleep(1) + machine.send_chars("foobar\n") + machine.sleep(1) + machine.wait_until_succeeds("pgrep -u alice bash") + machine.screenshot("postlogin") + machine.send_chars("touch done\n") + machine.wait_for_file("/home/alice/done") + ''; +} diff --git a/pkgs/by-name/le/lemurs/package.nix b/pkgs/by-name/le/lemurs/package.nix index 1f61fc809df0..cfec0fb76cc2 100644 --- a/pkgs/by-name/le/lemurs/package.nix +++ b/pkgs/by-name/le/lemurs/package.nix @@ -6,6 +6,7 @@ rustPlatform, systemdMinimal, versionCheckHook, + nixosTests, }: rustPlatform.buildRustPackage rec { pname = "lemurs"; @@ -30,6 +31,16 @@ rustPlatform.buildRustPackage rec { doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ]; + passthru.tests = { + inherit (nixosTests) + lemurs + lemurs-wayland + lemurs-wayland-script + lemurs-xorg + lemurs-xorg-script + ; + }; + meta = { description = "Customizable TUI display/login manager written in Rust"; homepage = "https://github.com/coastalwhite/lemurs";