Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NixOS Module evremap #362661

Merged
merged 7 commits into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions nixos/modules/services/misc/evremap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
let
cfg = config.services.evremap;
format = pkgs.formats.toml { };
settings = lib.attrsets.filterAttrs (n: v: v != null) cfg.settings;
configFile = format.generate "evremap.toml" settings;

key = lib.types.strMatching "KEY_[[:upper:]]+" // {
description = "key ID prefixed with KEY_";
key = lib.types.strMatching "(BTN|KEY)_[[:upper:]]+" // {
description = "key ID prefixed with BTN_ or KEY_";
};

mkKeyOption =
Expand Down Expand Up @@ -63,6 +65,18 @@ in
'';
};

phys = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "usb-0000:07:00.3-2.1.1/input0";
description = ''
The physical device name to listen on.

This attribute may be specified to disambiguate multiple devices with the same device name.
The physical device names of each device can be obtained by running `evremap list-devices` with elevated permissions.
'';
};

dual_role = lib.mkOption {
type = lib.types.listOf dualRoleModule;
default = [ ];
Expand Down Expand Up @@ -117,7 +131,7 @@ in
description = "evremap - keyboard input remapper";
wantedBy = [ "multi-user.target" ];

script = "${lib.getExe pkgs.evremap} remap ${format.generate "evremap.toml" cfg.settings}";
script = "${lib.getExe pkgs.evremap} remap ${configFile}";

serviceConfig = {
DynamicUser = true;
Expand Down
Loading