diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 613ff1314488..147e9c11612e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -520,6 +520,7 @@ in { keyd = handleTest ./keyd.nix {}; keymap = handleTest ./keymap.nix {}; kimai = handleTest ./kimai.nix {}; + kmonad = runTest ./kmonad.nix; knot = handleTest ./knot.nix {}; komga = handleTest ./komga.nix {}; krb5 = discoverTests (import ./krb5); diff --git a/nixos/tests/kmonad.nix b/nixos/tests/kmonad.nix new file mode 100644 index 000000000000..e0150cb99f18 --- /dev/null +++ b/nixos/tests/kmonad.nix @@ -0,0 +1,47 @@ +{ lib, ... }: + +{ + name = "kmonad"; + + meta = { + maintainers = with lib.maintainers; [ linj ]; + }; + + nodes = { + machine = { + services.kmonad = { + enable = true; + keyboards = { + defaultKbd = { + device = "/dev/input/by-id/vm-default-kbd"; + defcfg = { + enable = true; + fallthrough = true; + }; + config = '' + (defsrc :name default-src + 1) + (deflayer default-layer :source default-src + @T2) + (defalias + T2 2) + ''; + }; + }; + }; + + # make a determinate symlink to the default vm keyboard for kmonad to use + services.udev.extraRules = '' + ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="QEMU Virtio Keyboard", ATTRS{id/product}=="0001", ATTRS{id/vendor}=="0627", SYMLINK+="input/by-id/vm-default-kbd" + ''; + }; + }; + + testScript = '' + service_name = "kmonad-defaultKbd" + machine.wait_for_unit(f"{service_name}.service") + + with subtest("kmonad is running"): + machine.succeed(f"systemctl status {service_name}") + ''; +} diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 2a92ef16dc6f..9bf3d526ab87 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -1478,7 +1478,14 @@ self: super: builtins.intersectAttrs super { # cause actual problems in dependent packages, see https://github.com/lehins/pvar/issues/4 pvar = dontCheck super.pvar; - kmonad = enableSeparateBinOutput super.kmonad; + kmonad = lib.pipe super.kmonad [ + enableSeparateBinOutput + (overrideCabal (drv: { + passthru = lib.recursiveUpdate + drv.passthru or { } + { tests.nixos = pkgs.nixosTests.kmonad; }; + })) + ]; xmobar = enableSeparateBinOutput super.xmobar;