commit d4ebdaa56a94baf7ec36478590e9187b8ca3c0b9
parent e87dba82ae755223c3866bb2875ef5381f5c0c95
Author: Katja (ctucx) <git@ctu.cx>
Date: Fri, 16 May 2025 15:06:23 +0200
parent e87dba82ae755223c3866bb2875ef5381f5c0c95
Author: Katja (ctucx) <git@ctu.cx>
Date: Fri, 16 May 2025 15:06:23 +0200
nixosModules/sapphicCfg/hardware: add module `fprint` (and enable on host `huntii`)
2 files changed, 56 insertions(+), 1 deletion(-)
A
|
54
++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/hosts/huntii/default.nix b/hosts/huntii/default.nix @@ -24,11 +24,12 @@ hardware = { video.intel.enable = true; cpu.updateMicrocode = true; + fprint.enable = true; }; presets = { - katja.enable = true; base.enable = true; + katja.enable = true; graphical.enable = true; graphical.type = "gnomeMinimal";
diff --git a/nixosModules/sapphicCfg/hardware/fprint.nix b/nixosModules/sapphicCfg/hardware/fprint.nix @@ -0,0 +1,54 @@ +{ + povSelf, + hostConfig, + config, + lib, + pkgs, + ... +}: +let + inherit (lib) types; + cfg = lib.getAttrFromPath povSelf config; + cfgRoot = lib.getAttrFromPath (lib.remove [ "hardware" "fpint" ] povSelf) config; + +in +{ + + options = { + enable = { + type = types.bool; + default = false; + }; + enableGoodixDriver = { + type = types.bool; + default = false; + }; + }; + + config = lib.mkIf cfg.enable (lib.mkMerge [ + { + services.fprintd.enable = true; + } + ( + lib.mkIf cfg.enableGoodixDriver { + assertions = [ + { + assertion = cfg.enableGoodixDriver -> cfgRoot.modules.unfree.enable; + message = '' + The hardware.fprint.enableGoodixDriver option uses unfree software. + To use it you need to set modules.unfree.enable to true. + ''; + } + ]; + + sapphicCfg.modules.unfree.list = [ "libfprint-2-tod1-goodix" ]; + + services.fprintd.tod = { + enable = lib.mkDefault true; + driver = lib.mkDefault pkgs.libfprint-2-tod1-goodix; + }; + } + ) + ]); + +}