nixos/pcscd: use unit files from upstream

This commit is contained in:
Peter Hoeg 2020-09-08 20:32:16 +08:00
parent 2b93e96d0b
commit 6c59345235

View file

@ -10,39 +10,37 @@ let
paths = map (p: "${p}/pcsc/drivers") config.services.pcscd.plugins;
};
in {
in
{
###### interface
options = {
options.services.pcscd = {
enable = mkEnableOption "PCSC-Lite daemon";
services.pcscd = {
enable = mkEnableOption "PCSC-Lite daemon";
plugins = mkOption {
type = types.listOf types.package;
default = [ pkgs.ccid ];
defaultText = "[ pkgs.ccid ]";
example = literalExample "[ pkgs.pcsc-cyberjack ]";
description = "Plugin packages to be used for PCSC-Lite.";
};
plugins = mkOption {
type = types.listOf types.package;
default = [ pkgs.ccid ];
defaultText = "[ pkgs.ccid ]";
example = literalExample "[ pkgs.pcsc-cyberjack ]";
description = "Plugin packages to be used for PCSC-Lite.";
};
readerConfig = mkOption {
type = types.lines;
default = "";
example = ''
FRIENDLYNAME "Some serial reader"
DEVICENAME /dev/ttyS0
LIBPATH /path/to/serial_reader.so
CHANNELID 1
'';
description = ''
Configuration for devices that aren't hotpluggable.
readerConfig = mkOption {
type = types.lines;
default = "";
example = ''
FRIENDLYNAME "Some serial reader"
DEVICENAME /dev/ttyS0
LIBPATH /path/to/serial_reader.so
CHANNELID 1
'';
description = ''
Configuration for devices that aren't hotpluggable.
See <citerefentry><refentrytitle>reader.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for valid options.
'';
};
See <citerefentry><refentrytitle>reader.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for valid options.
'';
};
};
@ -50,20 +48,15 @@ in {
config = mkIf config.services.pcscd.enable {
systemd.sockets.pcscd = {
description = "PCSC-Lite Socket";
wantedBy = [ "sockets.target" ];
before = [ "multi-user.target" ];
socketConfig.ListenStream = "/run/pcscd/pcscd.comm";
};
environment.etc."reader.conf".source = cfgFile;
systemd.packages = [ (getBin pkgs.pcsclite) ];
systemd.sockets.pcscd.wantedBy = [ "sockets.target" ];
systemd.services.pcscd = {
description = "PCSC-Lite daemon";
environment.PCSCLITE_HP_DROPDIR = pluginEnv;
serviceConfig = {
ExecStart = "${getBin pkgs.pcsclite}/sbin/pcscd -f -x -c ${cfgFile}";
ExecReload = "${getBin pkgs.pcsclite}/sbin/pcscd -H";
};
restartTriggers = [ "/etc/reader.conf" ];
};
};
}