diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 363296b713e9b5..54979866b16238 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -75,6 +75,8 @@ - [Howdy](https://github.com/boltgolt/howdy), a Windows Helloâ„¢ style facial authentication program for Linux. +- [linux-enable-ir-emitter](https://github.com/EmixamPP/linux-enable-ir-emitter), a tool used to set up IR cameras, used with Howdy. + - [Privatebin](https://github.com/PrivateBin/PrivateBin/), A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Available as [services.privatebin](#opt-services.privatebin.enable) - [UWSM](https://github.com/Vladimir-csp/uwsm), a wayland session manager to wrap Wayland Compositors into useful systemd units such as `graphical-session.target`. Available as [programs.uwsm](#opt-programs.uwsm.enable). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index ecb4171c672eb9..081b9a35f8d467 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -782,6 +782,7 @@ ./services/misc/lidarr.nix ./services/misc/lifecycled.nix ./services/misc/llama-cpp.nix + ./services/misc/linux-enable-ir-emitter.nix ./services/misc/logkeys.nix ./services/misc/mame.nix ./services/misc/mbpfan.nix diff --git a/nixos/modules/services/misc/linux-enable-ir-emitter.nix b/nixos/modules/services/misc/linux-enable-ir-emitter.nix new file mode 100644 index 00000000000000..3d6bbe3083b852 --- /dev/null +++ b/nixos/modules/services/misc/linux-enable-ir-emitter.nix @@ -0,0 +1,63 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.linux-enable-ir-emitter; +in +{ + options = { + services.linux-enable-ir-emitter = { + enable = lib.mkEnableOption "" // { + description = '' + Whether to enable IR emitter hardware. Designed to be used with the + Howdy facial authentication. After enabling the service, configure + the emitter with `sudo linux-enable-ir-emitter configure`. + ''; + }; + + package = lib.mkPackageOption pkgs "linux-enable-ir-emitter" { } // { + description = '' + Package to use for the Linux Enable IR Emitter service. + ''; + }; + + device = lib.mkOption { + type = lib.types.str; + default = "video2"; + description = '' + IR camera device to depend on. For example, for `/dev/video2` + the value would be `video2`. Find this with the command + {command}`realpath /dev/v4l/by-path/`. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ cfg.package ]; + + # https://github.com/EmixamPP/linux-enable-ir-emitter/blob/7e3a6527ef2efccabaeefc5a93c792628325a8db/sources/systemd/linux-enable-ir-emitter.service + systemd.services.linux-enable-ir-emitter = + let + targets = [ + "suspend.target" + "sleep.target" + "hybrid-sleep.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + in + { + description = "Enable the infrared emitter"; + script = "${lib.getExe cfg.package} run"; + serviceConfig.ConfigurationDirectory = "linux-enable-ir-emitter"; + serviceConfig.StateDirectory = "linux-enable-ir-emitter"; + + wantedBy = targets ++ [ "multi-user.target" ]; + after = targets ++ [ "dev-${cfg.device}.device" ]; + }; + }; +}