nixos/kanata: check the config file at build time

Before this patch, checking the config file is done at runtime.
Doing so at build time shortens the feedback loop[1][2].

[1]: https://github.com/NixOS/nixpkgs/issues/278135
[2]: https://github.com/jtroo/kanata/issues/689
This commit is contained in:
Lin Jian 2024-05-06 19:39:20 +08:00
parent ed7d332850
commit 1d93534ec4
No known key found for this signature in database
GPG key ID: A6698D36434F75A5

View file

@ -86,14 +86,20 @@ let
in
optionalString ((length devices) > 0) "linux-dev (${devicesString})";
mkConfig = name: keyboard: pkgs.writeText "${mkName name}-config.kdb" ''
(defcfg
${keyboard.extraDefCfg}
${mkDevices keyboard.devices}
linux-continue-if-no-devs-found yes)
mkConfig = name: keyboard: pkgs.writeTextFile {
name = "${mkName name}-config.kdb";
text = ''
(defcfg
${keyboard.extraDefCfg}
${mkDevices keyboard.devices}
linux-continue-if-no-devs-found yes)
${keyboard.config}
'';
${keyboard.config}
'';
checkPhase = ''
${getExe cfg.package} --cfg "$target" --check --debug
'';
};
mkService = name: keyboard: nameValuePair (mkName name) {
wantedBy = [ "multi-user.target" ];