~andir/nixpkgs-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
9 2

[v2] pcsclite, pcsc{-d,tools}: fix cross, {systemd,udev,dbus}Support flags

Details
Message ID
<20240415201349.28735-1-adam@westernsemico.com>
DKIM signature
pass
Download raw message
Changes from v1:

1. (Thanks flokli for noticing!): first patch (pcsclite: remove isLinux
   condition from --enable-ipcdir) of previous version would produce undesired
   results (enabled `--with-systemunitdir` everywhere) if applied without the
   second patch in the series.  Fixed in v2.  No change to the result of
   applying the entire series.

2. `pcsclite: make udevSupport optional`: previous series swapped the order of
   two of the buildInputs, which would cause an unnecessary rebuild in the
   common (hydra) case.  This version maintains the original order, so no
   rebuild.

[PATCH 1/6] pcsclite: remove isLinux condition from --enable-ipcdir configureFlag

Details
Message ID
<20240415201349.28735-2-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +1 -1
The `--enable-ipcdir=/run/pcscd` flag was added by commit 2b93e96d0bdf5
"pcsclite: add policy kit support".  However the pcscd IPC mechanism is
completely independent from polkit, systemd, and dbus.  There is no reason to
disable the IPC mechanism on all non-Linux platforms.
---
 pkgs/tools/security/pcsclite/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix
index 956bf451c7bf..ed5e8163eebc 100644
--- a/pkgs/tools/security/pcsclite/default.nix
+++ b/pkgs/tools/security/pcsclite/default.nix
@@ -37,8 +37,8 @@ stdenv.mkDerivation (finalAttrs: {
    "--enable-usbdropdir=/var/lib/pcsc/drivers"
    (lib.enableFeature stdenv.isLinux "libsystemd")
    (lib.enableFeature polkitSupport "polkit")
  ] ++ lib.optionals stdenv.isLinux [
    "--enable-ipcdir=/run/pcscd"
  ] ++ lib.optionals stdenv.isLinux [
    "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
  ];

-- 
2.42.0

[PATCH 2/6] pcsclite: make systemdSupport optional

Details
Message ID
<20240415201349.28735-3-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +4 -3
---
 pkgs/tools/security/pcsclite/default.nix | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix
index ed5e8163eebc..28a19aefa0d9 100644
--- a/pkgs/tools/security/pcsclite/default.nix
+++ b/pkgs/tools/security/pcsclite/default.nix
@@ -10,6 +10,7 @@
, dbus
, polkit
, systemdLibs
, systemdSupport ? stdenv.isLinux
, IOKit
, testers
, nix-update-script
@@ -35,10 +36,10 @@ stdenv.mkDerivation (finalAttrs: {
    "--enable-confdir=/etc"
    # The OS should care on preparing the drivers into this location
    "--enable-usbdropdir=/var/lib/pcsc/drivers"
    (lib.enableFeature stdenv.isLinux "libsystemd")
    (lib.enableFeature systemdSupport "libsystemd")
    (lib.enableFeature polkitSupport "polkit")
    "--enable-ipcdir=/run/pcscd"
  ] ++ lib.optionals stdenv.isLinux [
  ] ++ lib.optionals systemdSupport [
    "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
  ];

@@ -70,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  buildInputs = [ python3 ]
    ++ lib.optionals stdenv.isLinux [ systemdLibs ]
    ++ lib.optionals systemdSupport [ systemdLibs ]
    ++ lib.optionals stdenv.isDarwin [ IOKit ]
    ++ lib.optionals polkitSupport [ dbus polkit ];

-- 
2.42.0

[PATCH 3/6] pcsclite: make dbusSupport optional

Details
Message ID
<20240415201349.28735-4-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +7 -1
---
 pkgs/tools/security/pcsclite/default.nix | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix
index 28a19aefa0d9..d0160388ca65 100644
--- a/pkgs/tools/security/pcsclite/default.nix
+++ b/pkgs/tools/security/pcsclite/default.nix
@@ -10,6 +10,7 @@
, dbus
, polkit
, systemdLibs
, dbusSupport ? stdenv.isLinux
, systemdSupport ? stdenv.isLinux
, IOKit
, testers
@@ -18,6 +19,9 @@
, polkitSupport ? false
}:

assert polkitSupport -> dbusSupport;
assert systemdSupport -> dbusSupport;

stdenv.mkDerivation (finalAttrs: {
  inherit pname;
  version = "2.0.3";
@@ -73,7 +77,9 @@ stdenv.mkDerivation (finalAttrs: {
  buildInputs = [ python3 ]
    ++ lib.optionals systemdSupport [ systemdLibs ]
    ++ lib.optionals stdenv.isDarwin [ IOKit ]
    ++ lib.optionals polkitSupport [ dbus polkit ];
    ++ lib.optionals dbusSupport [ dbus ]
    ++ lib.optionals polkitSupport [ polkit ]
  ;

  passthru = {
    tests.version = testers.testVersion {
-- 
2.42.0

[PATCH 4/6] pcsclite: make udevSupport optional

Details
Message ID
<20240415201349.28735-5-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +5 -0
This commit allows the use of pcscd on platforms which use mdevd and
libudev-zero instead of systemd-udevd.

When udevd is not running, pcscd needs to link against libusb so that it can
scan the USB busses itself, rather than relying on udevd to do that.
---
 pkgs/tools/security/pcsclite/default.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix
index d0160388ca65..93b191c675e0 100644
--- a/pkgs/tools/security/pcsclite/default.nix
+++ b/pkgs/tools/security/pcsclite/default.nix
@@ -12,6 +12,7 @@
, systemdLibs
, dbusSupport ? stdenv.isLinux
, systemdSupport ? stdenv.isLinux
, udevSupport ? dbusSupport, libusb
, IOKit
, testers
, nix-update-script
@@ -19,6 +20,7 @@
, polkitSupport ? false
}:

assert dbusSupport -> udevSupport;
assert polkitSupport -> dbusSupport;
assert systemdSupport -> dbusSupport;

@@ -45,6 +47,8 @@ stdenv.mkDerivation (finalAttrs: {
    "--enable-ipcdir=/run/pcscd"
  ] ++ lib.optionals systemdSupport [
    "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
  ] ++ lib.optionals (!udevSupport) [
    "--disable-libudev"
  ];

  makeFlags = [
@@ -79,6 +83,7 @@ stdenv.mkDerivation (finalAttrs: {
    ++ lib.optionals stdenv.isDarwin [ IOKit ]
    ++ lib.optionals dbusSupport [ dbus ]
    ++ lib.optionals polkitSupport [ polkit ]
    ++ lib.optionals (!udevSupport) [ libusb ]
  ;

  passthru = {
-- 
2.42.0

[PATCH 5/6] perlPackages.ChipcardPCSC: fix cross

Details
Message ID
<20240415201349.28735-6-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +3 -0
---
 pkgs/top-level/perl-packages.nix | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index bf073f4b7bcf..38b9aabb6cb8 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -3312,6 +3312,9 @@ with self; {
      "-Wno-error=implicit-int"
      "-Wno-error=int-conversion"
    ]);
    postPatch = ''
      substituteInPlace Makefile.PL --replace pkg-config $PKG_CONFIG
    '';
    NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.pcsclite}/lib -lpcsclite";
    # tests fail; look unfinished
    doCheck = false;
-- 
2.42.0

[PATCH 6/6] pcsc-tools: make gui, dbus, and systemd each (independently) optional

Details
Message ID
<20240415201349.28735-7-adam@westernsemico.com>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
Patch: +17 -6
---
 pkgs/tools/security/pcsc-tools/default.nix | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/pkgs/tools/security/pcsc-tools/default.nix b/pkgs/tools/security/pcsc-tools/default.nix
index c479caa0a613..29d4562d47c5 100644
--- a/pkgs/tools/security/pcsc-tools/default.nix
+++ b/pkgs/tools/security/pcsc-tools/default.nix
@@ -7,8 +7,8 @@
, makeWrapper
, pkg-config
, wrapGAppsHook
, systemd
, dbus
, systemdSupport ? stdenv.isLinux, systemd
, dbusSupport ? stdenv.isLinux, dbus
, pcsclite
, PCSC
, wget
@@ -16,8 +16,13 @@
, perlPackages
, testers
, nix-update-script

# gui does not cross compile properly
, withGui ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
}:

assert systemdSupport -> dbusSupport;

stdenv.mkDerivation (finalAttrs: {
  pname = "pcsc-tools";
  version = "1.7.1";
@@ -33,16 +38,20 @@ stdenv.mkDerivation (finalAttrs: {
    "--datarootdir=${placeholder "out"}/share"
  ];

  buildInputs = [ dbus perlPackages.perl pcsclite ]
    ++ lib.optional stdenv.isDarwin PCSC
    ++ lib.optional stdenv.isLinux systemd;
  buildInputs = lib.optionals dbusSupport [
    dbus
  ] ++ [
    perlPackages.perl pcsclite
  ] ++ lib.optional stdenv.isDarwin PCSC
    ++ lib.optional systemdSupport systemd;

  nativeBuildInputs = [
    autoconf-archive
    autoreconfHook
    gobject-introspection
    makeWrapper
    pkg-config
  ] ++ lib.optionals withGui [
    gobject-introspection
    wrapGAppsHook
  ];

@@ -54,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: {
    wrapProgram $out/bin/scriptor \
      --set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"

  '' + lib.optionalString withGui ''
    wrapProgram $out/bin/gscriptor \
      ''${makeWrapperArgs[@]} \
      --set PERL5LIB "${with perlPackages; makePerlPath [
@@ -66,6 +76,7 @@ stdenv.mkDerivation (finalAttrs: {
          Cairo
          CairoGObject
      ]}"
  '' + ''

    wrapProgram $out/bin/ATR_analysis \
      --set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"
-- 
2.42.0
Details
Message ID
<42hkykk4guzrxlsgzbtihhxokjgw4xmujefamytv3rhb7k5xqg@fjp6ubqm7eri>
In-Reply-To
<20240415201349.28735-1-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
I tried building `pkgsCross.aarch64-multiplatform.pcsc-tools` from
a `x86_64-linux` system.

At least on master, there was a cross regression for gnupg (which I hit
when building pcsc-tools with systemd support, as systemd (or importd more
specifically) uses gnupg.

Though if I disable that, it successfully builds, it's unrelated to
your patchset anyways (and maybe fixed in staging, didn't check).

On Mon, Apr 15, 2024 at 01:09:16PM -0700, Adam Joseph wrote:
>Changes from v1:
>
>1. (Thanks flokli for noticing!): first patch (pcsclite: remove isLinux
>   condition from --enable-ipcdir) of previous version would produce undesired
>   results (enabled `--with-systemunitdir` everywhere) if applied without the
>   second patch in the series.  Fixed in v2.  No change to the result of
>   applying the entire series.
>
>2. `pcsclite: make udevSupport optional`: previous series swapped the order of
>   two of the buildInputs, which would cause an unnecessary rebuild in the
>   common (hydra) case.  This version maintains the original order, so no
>   rebuild.

Note this still causes a lot of rebuilds, probably due to the move of
gobject-introspection (?).
Are you OK with this simply targeting staging?

flokli
Details
Message ID
<z7zyrufylcuvjffvka5uy5ybsfjuyznxad4oyqdpooaxgphnvh@ac4n4aze44qa>
In-Reply-To
<42hkykk4guzrxlsgzbtihhxokjgw4xmujefamytv3rhb7k5xqg@fjp6ubqm7eri> (view parent)
DKIM signature
pass
Download raw message
On Tue, Apr 16, 2024 at 10:57:24PM +0300, Florian Klink wrote:
>I tried building `pkgsCross.aarch64-multiplatform.pcsc-tools` from
>a `x86_64-linux` system.
>
>At least on master, there was a cross regression for gnupg (which I hit
>when building pcsc-tools with systemd support, as systemd (or importd more
>specifically) uses gnupg.
>
>Though if I disable that, it successfully builds, it's unrelated to
>your patchset anyways (and maybe fixed in staging, didn't check).
>
>On Mon, Apr 15, 2024 at 01:09:16PM -0700, Adam Joseph wrote:
>>Changes from v1:
>>
>>1. (Thanks flokli for noticing!): first patch (pcsclite: remove isLinux
>>  condition from --enable-ipcdir) of previous version would produce undesired
>>  results (enabled `--with-systemunitdir` everywhere) if applied without the
>>  second patch in the series.  Fixed in v2.  No change to the result of
>>  applying the entire series.
>>
>>2. `pcsclite: make udevSupport optional`: previous series swapped the order of
>>  two of the buildInputs, which would cause an unnecessary rebuild in the
>>  common (hydra) case.  This version maintains the original order, so no
>>  rebuild.
>
>Note this still causes a lot of rebuilds, probably due to the move of
>gobject-introspection (?).
>Are you OK with this simply targeting staging?

As the patches started to not apply anymore, I manually rebased this
on staging, and sent it out (modulo some formatter fixes) to
https://github.com/NixOS/nixpkgs/pull/305260.

I'll undraft this PR once I finished building.
Details
Message ID
<171400689715.19292.2369403356210868005@localhost>
In-Reply-To
<z7zyrufylcuvjffvka5uy5ybsfjuyznxad4oyqdpooaxgphnvh@ac4n4aze44qa> (view parent)
DKIM signature
pass
Download raw message
Quoting Florian Klink (2024-04-19 01:23:23)
> >Note this still causes a lot of rebuilds, probably due to the move of
> >gobject-introspection (?).
> >Are you OK with this simply targeting staging?

Yes of course; sorry about the slow reply.

> As the patches started to not apply anymore, I manually rebased this
> on staging, and sent it out (modulo some formatter fixes) to
> https://github.com/NixOS/nixpkgs/pull/305260.
>
> I'll undraft this PR once I finished building.

I see that you did, and that it was merged.  Thank you so much!

  - a
Reply to thread Export thread (mbox)