about summary refs log tree commit diff
path: root/nixos/modules/services/hardware/pcscd.nix
blob: 6d429c94b28fc89f239e8f218a8cfba426179c94 (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
47
{ config, pkgs, ... }:

let
  cfgFile = pkgs.writeText "reader.conf" "";
in

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 {

    systemd.services.pcscd = {
      description = "PCSC-Lite daemon";
      wantedBy = [ "multi-user.target" ];
      preStart = ''
          mkdir -p /var/lib/pcsc
          rm -Rf /var/lib/pcsc/drivers
          ln -s ${pkgs.ccid}/pcsc/drivers /var/lib/pcsc/
      '';
      serviceConfig = {
        Type = "forking";
        ExecStart = "${pkgs.pcsclite}/sbin/pcscd -c ${cfgFile}";
      };
    };

  };

}