diff options
author | sinanmohd <sinan@firemail.cc> | 2023-08-25 10:59:57 +0530 |
---|---|---|
committer | tomf <tom@tom-fitzhenry.me.uk> | 2023-11-23 13:50:14 +1100 |
commit | aa0b9d27801654dd3ff1e0cb50d34aefd651c799 (patch) | |
tree | 3327b6f753428b598a38edfddcb863250dd2145a /nixos | |
parent | 9796cbb02175622a5576d53cd340d8e25a6944bc (diff) | |
download | nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar.gz nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar.bz2 nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar.lz nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar.xz nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.tar.zst nixlib-aa0b9d27801654dd3ff1e0cb50d34aefd651c799.zip |
nixos/tests/seatd: init
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/seatd.nix | 51 |
2 files changed, 52 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 44e99203856d..3b0871e36a77 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -742,6 +742,7 @@ in { sddm = handleTest ./sddm.nix {}; seafile = handleTest ./seafile.nix {}; searx = handleTest ./searx.nix {}; + seatd = handleTest ./seatd.nix {}; service-runner = handleTest ./service-runner.nix {}; sftpgo = runTest ./sftpgo.nix; sfxr-qt = handleTest ./sfxr-qt.nix {}; diff --git a/nixos/tests/seatd.nix b/nixos/tests/seatd.nix new file mode 100644 index 000000000000..138a6cb1cf44 --- /dev/null +++ b/nixos/tests/seatd.nix @@ -0,0 +1,51 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: + +let + seatd-test = pkgs.writeShellApplication { + name = "seatd-client-pid"; + text = '' + journalctl -u seatd --no-pager -b | while read -r line; do + case "$line" in + *"New client connected"*) + line="''${line##*pid: }" + pid="''${line%%,*}" + ;; + *"Opened client"*) + echo "$pid" + exit + esac + done; + ''; + }; +in +{ + name = "seatd"; + meta.maintainers = with lib.maintainers; [ sinanmohd ]; + + nodes.machine = { ... }: { + imports = [ ./common/user-account.nix ]; + services.getty.autologinUser = "alice"; + users.users.alice.extraGroups = [ "seat" "wheel" ]; + + fonts.enableDefaultPackages = true; + environment.systemPackages = with pkgs; [ + dwl + foot + seatd-test + ]; + + programs.bash.loginShellInit = '' + [ "$(tty)" = "/dev/tty1" ] && + dwl -s 'foot touch /tmp/foot_started' + ''; + + hardware.opengl.enable = true; + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + services.seatd.enable = true; + }; + + testScript = '' + machine.wait_for_file("/tmp/foot_started") + machine.succeed("test $(seatd-client-pid) = $(pgrep dwl)") + ''; +}) |