From ad3484799131c15fe3b60d401f1e42ae3813c0cf Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 26 Oct 2024 10:40:35 +0200 Subject: [PATCH] fix: yubikey broke --- pkgs/ccid.nix | 85 +++++++++++++++++++++++ pkgs/default.nix | 1 + users/common/graphical/wayland/fuzzel.nix | 2 +- users/common/programs/gpg.nix | 2 +- 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 pkgs/ccid.nix diff --git a/pkgs/ccid.nix b/pkgs/ccid.nix new file mode 100644 index 0000000..9da29d3 --- /dev/null +++ b/pkgs/ccid.nix @@ -0,0 +1,85 @@ +{ + lib, + stdenv, + fetchurl, + flex, + gitUpdater, + libusb1, + meson, + ninja, + pcsclite, + perl, + pkg-config, + zlib, +}: + +stdenv.mkDerivation rec { + pname = "ccid"; + version = "1.6.1"; + + src = fetchurl { + url = "https://ccid.apdu.fr/files/${pname}-${version}.tar.xz"; + hash = "sha256-LsqPsH6P58DTna6sp7l81zxA7Ztyc4okrT3L38kY4eo="; + }; + + postPatch = '' + patchShebangs . + substituteInPlace meson.build --replace-fail \ + "pcsc_dep.get_variable('usbdropdir')" \ + "'$out/pcsc/drivers'" + ''; + + mesonFlags = [ + (lib.mesonBool "serial" true) + ]; + + # error: call to undeclared function 'InterruptRead'; + # ISO C99 and later do not support implicit function declarations + env = lib.optionalAttrs stdenv.cc.isClang { + NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; + }; + + nativeBuildInputs = [ + flex + perl + pkg-config + meson + ninja + ]; + + buildInputs = [ + libusb1 + pcsclite + zlib + ]; + + postInstall = '' + install -Dm 0444 -t $out/lib/udev/rules.d ../src/92_pcscd_ccid.rules + substituteInPlace $out/lib/udev/rules.d/92_pcscd_ccid.rules \ + --replace-fail "/usr/sbin/pcscd" "${pcsclite}/bin/pcscd" + ''; + + # The resulting shared object ends up outside of the default paths which are + # usually getting stripped. + stripDebugList = [ "pcsc" ]; + + passthru.updateScript = gitUpdater { + url = "https://salsa.debian.org/rousseau/CCID.git"; + }; + + installCheckPhase = '' + [ -f $out/etc/reader.conf.d/libccidtwin ] + [ -f $out/lib/udev/rules.d/92_pcscd_ccid.rules ] + [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist ] + [ -f $out/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so ] + [ -f $out/pcsc/drivers/serial/libccidtwin.so ] + ''; + + meta = with lib; { + description = "PC/SC driver for USB CCID smart card readers"; + homepage = "https://ccid.apdu.fr/"; + license = licenses.lgpl21Plus; + maintainers = [ maintainers.anthonyroussel ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 3b0ef89..7771d76 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -9,6 +9,7 @@ _inputs: [ signal-to-blog = prev.callPackage ./signal-to-blog.nix { }; minion = prev.callPackage ./minion.nix { }; mongodb-bin = prev.callPackage ./mongodb-bin.nix { }; + ccid = prev.callPackage ./ccid.nix { }; awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix { }; neovim-clean = prev.neovim-unwrapped.overrideAttrs ( _neovimFinal: neovimPrev: { diff --git a/users/common/graphical/wayland/fuzzel.nix b/users/common/graphical/wayland/fuzzel.nix index a16039c..5744fa7 100644 --- a/users/common/graphical/wayland/fuzzel.nix +++ b/users/common/graphical/wayland/fuzzel.nix @@ -3,7 +3,7 @@ stylix.targets.fuzzel.enable = true; home.packages = with pkgs; [ (writeShellScriptBin "fuzzel" '' - ${fuzzel}/bin/fuzzel --background-color=000000ff + ${lib.getExe fuzzel} --background-color=000000ff '') ]; } diff --git a/users/common/programs/gpg.nix b/users/common/programs/gpg.nix index 061d196..62fc697 100644 --- a/users/common/programs/gpg.nix +++ b/users/common/programs/gpg.nix @@ -8,7 +8,7 @@ programs.gpg = { enable = true; - #scdaemonSettings.disable-ccid = true; + scdaemonSettings.disable-ccid = true; settings = { # https://github.com/drduh/config/blob/master/gpg.conf # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration-Options.html