From 1a817546620f1988b2330765f94db19f96b76210 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Fri, 29 May 2026 01:45:05 -0700 Subject: [PATCH 1/2] nixos/pcscd: expose package as option --- nixos/modules/services/hardware/pcscd.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/hardware/pcscd.nix b/nixos/modules/services/hardware/pcscd.nix index f7e23df84f01..0b9aae8e2bbd 100644 --- a/nixos/modules/services/hardware/pcscd.nix +++ b/nixos/modules/services/hardware/pcscd.nix @@ -10,8 +10,6 @@ let builtins.concatStringsSep "\n\n" config.services.pcscd.readerConfigs ); - package = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; - pluginEnv = pkgs.buildEnv { name = "pcscd-plugins"; paths = map (p: "${p}/pcsc/drivers") config.services.pcscd.plugins; @@ -36,6 +34,11 @@ in options.services.pcscd = { enable = lib.mkEnableOption "PCSC-Lite daemon, to access smart cards using SCard API (PC/SC)"; + package = (lib.mkPackageOption pkgs "pcsclite" { }) // { + default = if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite; + defaultText = lib.literalExpression "if config.security.polkit.enable then pkgs.pcscliteWithPolkit else pkgs.pcsclite"; + }; + plugins = lib.mkOption { type = lib.types.listOf lib.types.package; defaultText = lib.literalExpression "[ pkgs.ccid ]"; @@ -101,8 +104,8 @@ in config = lib.mkIf config.services.pcscd.enable { environment.etc."reader.conf".source = cfgFile; - environment.systemPackages = [ package ]; - systemd.packages = [ package ]; + environment.systemPackages = [ cfg.package ]; + systemd.packages = [ cfg.package ]; services.pcscd.plugins = [ pkgs.ccid ]; @@ -133,7 +136,7 @@ in # https://github.com/NixOS/nixpkgs/issues/121088 serviceConfig.ExecStart = [ "" - "${lib.getExe package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" + "${lib.getExe cfg.package} -f -x -c ${cfgFile} ${lib.escapeShellArgs cfg.extraArgs}" ]; }; From 1468d638d9872ddb999cfc3053cc66a0089eb59b Mon Sep 17 00:00:00 2001 From: Gavin John Date: Fri, 29 May 2026 01:48:27 -0700 Subject: [PATCH 2/2] pcsclite: enable structuredAttrs, separateDebugInfo, strictDeps __structuredAttrs and strictDeps being enabled are obvious. separateDebugInfo is enabled as it helps with troubleshooting broken plugins. --- pkgs/by-name/pc/pcsclite/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/pc/pcsclite/package.nix b/pkgs/by-name/pc/pcsclite/package.nix index c4d14fe7a137..271bf0fdd121 100644 --- a/pkgs/by-name/pc/pcsclite/package.nix +++ b/pkgs/by-name/pc/pcsclite/package.nix @@ -88,6 +88,10 @@ stdenv.mkDerivation (finalAttrs: { moveToOutput bin/pcsc-spy "$dev" ''; + __structuredAttrs = true; + separateDebugInfo = true; + strictDeps = true; + nativeBuildInputs = [ meson ninja