git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/fprintd: add service and pam support
commita164a0b4c571540289d4fd5d5bdbe3ca70e94f63 authorNikolay Amiantov <ab@fmap.me> dateSat 3 Jan 2015, 19:47 (12 years ago) parent006dceb
3 files changed+65
nixos/modules/module-list.nix+1 nixos/modules/security/pam.nix+11 nixos/modules/services/security/fprintd.nix+53
nixos/modules/module-list.nix+1
@@ -306,6 +306,7 @@
306306 ./services/search/solr.nix
307307 ./services/security/clamav.nix
308308 ./services/security/fail2ban.nix
309+ ./services/security/fprintd.nix
309310 ./services/security/fprot.nix
310311 ./services/security/frandom.nix
311312 ./services/security/haveged.nix
nixos/modules/security/pam.nix+11
@@ -54,6 +54,15 @@ let
5454 '';
5555 };
5656
57+ fprintAuth = mkOption {
58+ default = config.services.fprintd.enable;
59+ type = types.bool;
60+ description = ''
61+ If set, fingerprint reader will be used (if exists and
62+ your fingerprints are enrolled).
63+ '';
64+ };
65+
5766 sshAgentAuth = mkOption {
5867 default = false;
5968 type = types.bool;
@@ -179,6 +188,8 @@ let
179188 "auth required pam_tally.so"}
180189 ${optionalString (config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth)
181190 "auth sufficient ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so file=~/.ssh/authorized_keys:~/.ssh/authorized_keys2:/etc/ssh/authorized_keys.d/%u"}
191+ ${optionalString cfg.fprintAuth
192+ "auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so"}
182193 ${optionalString cfg.usbAuth
183194 "auth sufficient ${pkgs.pam_usb}/lib/security/pam_usb.so"}
184195 ${optionalString cfg.unixAuth
nixos/modules/services/security/fprintd.nixnew file+53
@@ -0,0 +1,53 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+ cfg = config.services.fprintd;
8+
9+in
10+
11+
12+{
13+
14+ ###### interface
15+
16+ options = {
17+
18+ services.fprintd = {
19+
20+ enable = mkOption {
21+ type = types.bool;
22+ default = false;
23+ description = ''
24+ Whether to enable fprintd daemon and PAM module for fingerprint readers handling.
25+ '';
26+ };
27+
28+ };
29+
30+ };
31+
32+
33+ ###### implementation
34+
35+ config = mkIf cfg.enable {
36+
37+ services.dbus.packages = [ pkgs.fprintd ];
38+
39+ environment.systemPackages = [ pkgs.fprintd ];
40+
41+ systemd.services.fprintd = {
42+ description = "Fingerprint Authentication Daemon";
43+
44+ serviceConfig = {
45+ Type = "dbus";
46+ BusName = "net.reactivated.Fprint";
47+ ExecStart = "${pkgs.fprintd}/libexec/fprintd";
48+ };
49+ };
50+
51+ };
52+
53+}