2010-01-11 22:56:01 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
2014-03-21 23:52:24 +01:00
|
|
|
let
|
|
|
|
cfgFile = pkgs.writeText "reader.conf" "";
|
|
|
|
in
|
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
services.pcscd = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the PCSC-Lite daemon.";
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf config.services.pcscd.enable {
|
|
|
|
|
2014-03-21 23:52:24 +01:00
|
|
|
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}";
|
2010-01-11 22:56:01 +01:00
|
|
|
};
|
2014-03-21 23:52:24 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-11 22:56:01 +01:00
|
|
|
}
|