diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-09-26 06:01:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 06:01:00 +0000 |
commit | 3bfcfd7eef0b5f5786c886bc536010dd47be1a7b (patch) | |
tree | bda56a5fc5221c396d6e6027877efbf7988c6a81 /nixos | |
parent | cc5ae613ff88e1b4afa396d30f4c61e340fe6649 (diff) | |
parent | cfe55e044a94919dd18ad14b17afd82dd6a87cd0 (diff) | |
download | nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar.gz nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar.bz2 nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar.lz nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar.xz nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.tar.zst nixlib-3bfcfd7eef0b5f5786c886bc536010dd47be1a7b.zip |
Merge master into staging-next
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/hardware/kanata.nix | 16 | ||||
-rw-r--r-- | nixos/modules/services/networking/wireguard.nix | 11 |
2 files changed, 25 insertions, 2 deletions
diff --git a/nixos/modules/services/hardware/kanata.nix b/nixos/modules/services/hardware/kanata.nix index 7d544050130b..aac20c6c760e 100644 --- a/nixos/modules/services/hardware/kanata.nix +++ b/nixos/modules/services/hardware/kanata.nix @@ -9,8 +9,14 @@ let options = { devices = mkOption { type = types.listOf types.str; + default = [ ]; example = [ "/dev/input/by-id/usb-0000_0000-event-kbd" ]; - description = mdDoc "Paths to keyboard devices."; + description = mdDoc '' + Paths to keyboard devices. + + An empty list, the default value, lets kanata detect which + input devices are keyboards and intercept them all. + ''; }; config = mkOption { type = types.lines; @@ -162,6 +168,14 @@ in }; config = mkIf cfg.enable { + warnings = + let + keyboardsWithEmptyDevices = filterAttrs (name: keyboard: keyboard.devices == [ ]) cfg.keyboards; + existEmptyDevices = length (attrNames keyboardsWithEmptyDevices) > 0; + moreThanOneKeyboard = length (attrNames cfg.keyboards) > 1; + in + optional (existEmptyDevices && moreThanOneKeyboard) "One device can only be intercepted by one kanata instance. Setting services.kanata.keyboards.${head (attrNames keyboardsWithEmptyDevices)}.devices = [ ] and using more than one services.kanata.keyboards may cause a race condition."; + hardware.uinput.enable = true; systemd.services = mapAttrs' mkService cfg.keyboards; diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix index 21473388d76e..d4099be12a27 100644 --- a/nixos/modules/services/networking/wireguard.nix +++ b/nixos/modules/services/networking/wireguard.nix @@ -164,6 +164,15 @@ let of the wireguard network has to be adjusted as well. ''; }; + + metric = mkOption { + default = null; + type = with types; nullOr int; + example = 700; + description = lib.mdDoc '' + Set the metric of routes related to this Wireguard interface. + ''; + }; }; }; @@ -395,7 +404,7 @@ let optionalString interfaceCfg.allowedIPsAsRoutes (concatMapStringsSep "\n" (allowedIP: - ''${ip} route replace "${allowedIP}" dev "${interfaceName}" table "${interfaceCfg.table}"'' + ''${ip} route replace "${allowedIP}" dev "${interfaceName}" table "${interfaceCfg.table}" ${optionalString (interfaceCfg.metric != null) "metric ${toString interfaceCfg.metric}"}'' ) peer.allowedIPs); in '' ${wg_setup} |