diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-02-18 01:09:19 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-02-18 01:09:19 +0000 |
commit | 95e667e9cda7c2611b9f3f97881134554e8e02d1 (patch) | |
tree | b2ae437f50c2dda8d3957e7ede4941606fd18b9d /nixpkgs/nixos | |
parent | 059076e2f2e2da91e3e6f7d5d6b116dc3cf4f601 (diff) | |
download | nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar.gz nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar.bz2 nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar.lz nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar.xz nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.tar.zst nixlib-95e667e9cda7c2611b9f3f97881134554e8e02d1.zip |
nixos/evscript: init
Diffstat (limited to 'nixpkgs/nixos')
-rw-r--r-- | nixpkgs/nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/services/hardware/evscript.nix | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/module-list.nix b/nixpkgs/nixos/modules/module-list.nix index 04bcb41cd07a..12d2aa7fc95b 100644 --- a/nixpkgs/nixos/modules/module-list.nix +++ b/nixpkgs/nixos/modules/module-list.nix @@ -281,6 +281,7 @@ ./services/hardware/actkbd.nix ./services/hardware/bluetooth.nix ./services/hardware/brltty.nix + ./services/hardware/evscript.nix ./services/hardware/freefall.nix ./services/hardware/fwupd.nix ./services/hardware/illum.nix diff --git a/nixpkgs/nixos/modules/services/hardware/evscript.nix b/nixpkgs/nixos/modules/services/hardware/evscript.nix new file mode 100644 index 000000000000..8caf9d38faaf --- /dev/null +++ b/nixpkgs/nixos/modules/services/hardware/evscript.nix @@ -0,0 +1,47 @@ +{ pkgs, lib, config, ... }: + +let + cfg = config.services.evscript; + +in +{ + options = with lib; { + services.evscript = { + enable = mkEnableOption "the evscript service"; + + package = mkOption { + description = "evscript package to use for the evscript service"; + type = types.package; + default = pkgs.evscript; + }; + + devices = mkOption { + description = "evdev devices for evscript to listen to"; + type = types.listOf types.path; + example = [ "/dev/input/by-path/pci-0000:00:1d.0-usb-0:1.1:1.0-event-kbd" ]; + }; + + script = mkOption { + description = "Dyon script for evscript service to run"; + type = types.path; + }; + }; + }; + + config = lib.mkIf cfg.enable { + services.udev.extraRules = '' + KERNEL=="uinput", MODE="0660", GROUP="input" + ''; + + systemd.services.evscript = { + wantedBy = [ "multi-user.target" ]; + serviceConfig.DynamicUser = true; + serviceConfig.SupplementaryGroups = [ "input" ]; + script = '' + ${cfg.package}/bin/evscript \ + ${lib.concatMapStringsSep " " (d: "-d ${d}") cfg.devices} \ + -f ${cfg.script} + ''; + }; + }; +} |