nixos/kmonad: create determinate symlinks (#370053)

Lin Jian 989c0760 2f8f9a06

Changed files
+15
nixos
doc
manual
release-notes
modules
services
hardware
tests
+2
nixos/doc/manual/release-notes/rl-2505.section.md
···
- For matrix homeserver Synapse we are now following the upstream recommendation to enable jemalloc as the memory allocator by default.
+
- `services.kmonad` now creates a determinate symlink (in `/dev/input/by-id/`) to each of KMonad virtual devices.
+
- `bind.cacheNetworks` now only controls access for recursive queries, where it previously controlled access for all queries.
- Caddy can now be built with plugins by using `caddy.withPlugins`, a `passthru` function that accepts an attribute set as a parameter. The `plugins` argument represents a list of Caddy plugins, with each Caddy plugin being a versioned module. The `hash` argument represents the `vendorHash` of the resulting Caddy source code with the plugins added.
+11
nixos/modules/services/hardware/kmonad.nix
···
config = lib.mkIf cfg.enable {
hardware.uinput.enable = true;
+
services.udev.extraRules =
+
let
+
mkRule = name: ''
+
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="${name}", ATTRS{id/product}=="5679", ATTRS{id/vendor}=="1235", SYMLINK+="input/by-id/${name}"
+
'';
+
in
+
lib.foldlAttrs (
+
rules: _: keyboard:
+
rules + "\n" + mkRule (mkName keyboard.name)
+
) "" cfg.keyboards;
+
systemd = {
paths = lib.mapAttrs' (_: mkPath) cfg.keyboards;
services = lib.mapAttrs' (_: mkService) cfg.keyboards;
+2
nixos/tests/kmonad.nix
···
with subtest("kmonad is running"):
machine.succeed(f"systemctl status {service_name}")
+
with subtest("kmonad symlink is created"):
+
machine.wait_for_file(f"/dev/input/by-id/{service_name}", timeout=5)
'';
}