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