summary refs log tree commit diff
path: root/nixos/modules/services/hardware/pcscd.nix
blob: 9f389efc06d4990df1f3381235204ea73f474682 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ config, pkgs, ... }:

with pkgs.lib;

{

  ###### interface

  options = {

    services.pcscd = {

      enable = mkOption {
        default = false;
        description = "Whether to enable the PCSC-Lite daemon.";
      };

    };

  };


  ###### implementation

  config = mkIf config.services.pcscd.enable {

    jobs.pcscd =
      { description = "PCSC-Lite daemon";

        startOn = "started udev";

        daemonType = "fork";

        # Add to the drivers directory the only drivers we have by now: ccid
        preStart = ''
            mkdir -p /var/lib/pcsc
            rm -Rf /var/lib/pcsc/drivers
            ln -s ${pkgs.ccid}/pcsc/drivers /var/lib/pcsc/
        '';

        exec = "${pkgs.pcsclite}/sbin/pcscd";
      };

  };

}