Merge pull request #189718 from rnhmjoj/pr-pcsc-polkit

This commit is contained in:
Sandro
2022-10-21 23:16:21 +02:00
committed by GitHub
4 changed files with 23 additions and 13 deletions
+7 -3
View File
@@ -5,6 +5,10 @@ with lib;
let
cfgFile = pkgs.writeText "reader.conf" config.services.pcscd.readerConfig;
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;
@@ -49,8 +53,8 @@ in
environment.etc."reader.conf".source = cfgFile;
environment.systemPackages = [ pkgs.pcsclite ];
systemd.packages = [ (getBin pkgs.pcsclite) ];
environment.systemPackages = [ package ];
systemd.packages = [ (getBin package) ];
systemd.sockets.pcscd.wantedBy = [ "sockets.target" ];
@@ -66,7 +70,7 @@ in
# around it, we force the path to the cfgFile.
#
# https://github.com/NixOS/nixpkgs/issues/121088
serviceConfig.ExecStart = [ "" "${getBin pkgs.pcsclite}/bin/pcscd -f -x -c ${cfgFile}" ];
serviceConfig.ExecStart = [ "" "${getBin package}/bin/pcscd -f -x -c ${cfgFile}" ];
};
};
}
@@ -188,7 +188,7 @@ stdenv.mkDerivation rec {
homepage = "http://www.freedesktop.org/wiki/Software/polkit";
description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
license = licenses.lgpl2Plus;
platforms = platforms.unix;
platforms = platforms.linux;
maintainers = teams.freedesktop.members ++ (with maintainers; [ ]);
};
}
+10 -9
View File
@@ -10,10 +10,12 @@
, polkit
, systemdMinimal
, IOKit
, pname ? "pcsclite"
, polkitSupport ? false
}:
stdenv.mkDerivation rec {
pname = "pcsclite";
inherit pname;
version = "1.9.5";
outputs = [ "bin" "out" "dev" "doc" "man" ];
@@ -34,14 +36,12 @@ stdenv.mkDerivation rec {
"--enable-confdir=/etc"
# The OS should care on preparing the drivers into this location
"--enable-usbdropdir=/var/lib/pcsc/drivers"
]
++ (if stdenv.isLinux then [
(lib.enableFeature stdenv.isLinux "systemd")
(lib.enableFeature polkitSupport "polkit")
] ++ lib.optionals stdenv.isLinux [
"--enable-ipcdir=/run/pcscd"
"--enable-polkit"
"--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
] else [
"--disable-libsystemd"
]);
];
postConfigure = ''
sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
@@ -59,8 +59,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ];
buildInputs = [ python3 ]
++ lib.optionals stdenv.isLinux [ dbus polkit systemdMinimal ]
++ lib.optionals stdenv.isDarwin [ IOKit ];
++ lib.optionals stdenv.isLinux [ systemdMinimal ]
++ lib.optionals stdenv.isDarwin [ IOKit ]
++ lib.optionals polkitSupport [ dbus polkit ];
meta = with lib; {
description = "Middleware to access a smart card using SCard API (PC/SC)";
+5
View File
@@ -10161,6 +10161,11 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) IOKit;
};
pcscliteWithPolkit = pcsclite.override {
pname = "pcsclite-with-polkit";
polkitSupport = true;
};
pcsctools = callPackage ../tools/security/pcsctools { };
pcsc-cyberjack = callPackage ../tools/security/pcsc-cyberjack { };