Loading nixos/modules/services/hardware/pcscd.nix +39 −15 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let cfg = config.services.pcscd; cfgFile = pkgs.writeText "reader.conf" config.services.pcscd.readerConfig; cfgFile = pkgs.writeText "reader.conf" ( builtins.concatStringsSep "\n\n" config.services.pcscd.readerConfigs ); package = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; package = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; pluginEnv = pkgs.buildEnv { name = "pcscd-plugins"; Loading @@ -14,6 +19,20 @@ let in { imports = [ (lib.mkChangedOptionModule [ "services" "pcscd" "readerConfig" ] [ "services" "pcscd" "readerConfigs" ] ( config: let readerConfig = lib.getAttrFromPath [ "services" "pcscd" "readerConfig" ] config; in [ readerConfig ] ) ) ]; options.services.pcscd = { enable = lib.mkEnableOption "PCSC-Lite daemon, to access smart cards using SCard API (PC/SC)"; Loading @@ -24,15 +43,17 @@ in description = "Plugin packages to be used for PCSC-Lite."; }; readerConfig = lib.mkOption { type = lib.types.lines; default = ""; example = '' readerConfigs = lib.mkOption { type = lib.types.listOf lib.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. Loading Loading @@ -68,7 +89,10 @@ in # around it, we force the path to the cfgFile. # # https://github.com/NixOS/nixpkgs/issues/121088 serviceConfig.ExecStart = [ "" "${lib.getExe package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" ]; serviceConfig.ExecStart = [ "" "${lib.getExe package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" ]; }; }; } Loading
nixos/modules/services/hardware/pcscd.nix +39 −15 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let cfg = config.services.pcscd; cfgFile = pkgs.writeText "reader.conf" config.services.pcscd.readerConfig; cfgFile = pkgs.writeText "reader.conf" ( builtins.concatStringsSep "\n\n" config.services.pcscd.readerConfigs ); package = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; package = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; pluginEnv = pkgs.buildEnv { name = "pcscd-plugins"; Loading @@ -14,6 +19,20 @@ let in { imports = [ (lib.mkChangedOptionModule [ "services" "pcscd" "readerConfig" ] [ "services" "pcscd" "readerConfigs" ] ( config: let readerConfig = lib.getAttrFromPath [ "services" "pcscd" "readerConfig" ] config; in [ readerConfig ] ) ) ]; options.services.pcscd = { enable = lib.mkEnableOption "PCSC-Lite daemon, to access smart cards using SCard API (PC/SC)"; Loading @@ -24,15 +43,17 @@ in description = "Plugin packages to be used for PCSC-Lite."; }; readerConfig = lib.mkOption { type = lib.types.lines; default = ""; example = '' readerConfigs = lib.mkOption { type = lib.types.listOf lib.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. Loading Loading @@ -68,7 +89,10 @@ in # around it, we force the path to the cfgFile. # # https://github.com/NixOS/nixpkgs/issues/121088 serviceConfig.ExecStart = [ "" "${lib.getExe package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" ]; serviceConfig.ExecStart = [ "" "${lib.getExe package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" ]; }; }; }