nixpkgs/nixos/modules/services/hardware/pcscd.nix
Eelco Dolstra 29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00

48 lines
781 B
Nix

{ config, lib, pkgs, ... }:
let
cfgFile = pkgs.writeText "reader.conf" "";
in
with 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}";
};
};
};
}