nixos/kmonad: add a basic nixos test

This commit is contained in:
Lin Jian
2025-01-01 10:33:37 +08:00
parent e695d85eb3
commit 16677264ae
3 changed files with 56 additions and 1 deletions
+1
View File
@@ -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);
+47
View File
@@ -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}")
'';
}
@@ -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;