about summary refs log tree commit diff
path: root/pkgs/tools/misc/yubico-piv-tool
diff options
context:
space:
mode:
authorAnthony Roussel <anthony@roussel.dev>2023-12-06 17:40:54 +0100
committerAnthony Roussel <anthony@roussel.dev>2023-12-06 17:43:43 +0100
commit4a538e5e7b913b25ac376aa6ac097ad55f0c486f (patch)
treee3c44267b809153e8f07b25c77c46e834bcc52a6 /pkgs/tools/misc/yubico-piv-tool
parentde7db40cfe275c6462407d9dc4bb9fe01c7d682a (diff)
yubico-piv-tool: use fetchFromGitHub and nix-update-script
Diffstat (limited to 'pkgs/tools/misc/yubico-piv-tool')
-rw-r--r--pkgs/tools/misc/yubico-piv-tool/default.nix36
1 files changed, 24 insertions, 12 deletions
diff --git a/pkgs/tools/misc/yubico-piv-tool/default.nix b/pkgs/tools/misc/yubico-piv-tool/default.nix
index dfa7f75671f69..240994912ca64 100644
--- a/pkgs/tools/misc/yubico-piv-tool/default.nix
+++ b/pkgs/tools/misc/yubico-piv-tool/default.nix
@@ -1,16 +1,17 @@
 { lib
 , stdenv
-, fetchurl
+, fetchFromGitHub
 , pkg-config
 , openssl
 , check
 , pcsclite
 , PCSC
 , gengetopt
+, help2man
 , cmake
 , zlib
 , withApplePCSC ? stdenv.isDarwin
-, gitUpdater
+, nix-update-script
 , testers
 , yubico-piv-tool
 }:
@@ -21,21 +22,33 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" "man" ];
 
-  src = fetchurl {
-    url = "https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-${version}.tar.gz";
-    hash = "sha256-oaqYtrF06yunfyleCMmAWYupR/aXsbcHygjHbPPdzms=";
+  src = fetchFromGitHub {
+    owner = "Yubico";
+    repo = "yubico-piv-tool";
+    rev = "refs/tags/yubico-piv-tool-${version}";
+    hash = "sha256-KprY5BX7Fi/qWRT1pda9g8fqnmDB1Bh7oFM7sCwViuw=";
   };
 
   postPatch = ''
     substituteInPlace CMakeLists.txt --replace "-Werror" ""
   '';
 
-  nativeBuildInputs = [ pkg-config cmake gengetopt ];
-  buildInputs = [ openssl check zlib.dev ]
-    ++ (if withApplePCSC then [ PCSC ] else [ pcsclite ]);
+  nativeBuildInputs = [
+    pkg-config
+    cmake
+    gengetopt
+    help2man
+  ];
+
+  buildInputs = [
+    openssl
+    check
+    zlib.dev
+  ]
+  ++ (if withApplePCSC then [ PCSC ] else [ pcsclite ]);
 
   cmakeFlags = [
-    "-DGENERATE_MAN_PAGES=OFF" # Use the man page generated at release time
+    "-DGENERATE_MAN_PAGES=ON"
     "-DCMAKE_INSTALL_BINDIR=bin"
     "-DCMAKE_INSTALL_INCLUDEDIR=include"
     "-DCMAKE_INSTALL_MANDIR=share/man"
@@ -45,9 +58,8 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--with-backend=${if withApplePCSC then "macscard" else "pcsc"}" ];
 
   passthru = {
-    updateScript = gitUpdater {
-      url = "https://github.com/Yubico/yubico-piv-tool.git";
-      rev-prefix = "yubico-piv-tool-";
+    updateScript = nix-update-script {
+      extraArgs = [ "--version-regex" "yubico-piv-tool-([0-9.]+)$" ];
     };
     tests.version = testers.testVersion {
       inherit version;