ctucx.git: nixfiles

ctucx' nixfiles

commit a3b50fbd444ff85be383028a9907372fef1c34a8
parent 06f8e394800eebe2e4dfdd9e53ba47291f9b1d21
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 16 Mar 2024 15:32:04 +0100

pkgs: add `usbtan-cli`
3 files changed, 54 insertions(+), 0 deletions(-)
M
pkgs/overlay.nix
|
1
+
A
pkgs/usbtan-cli/0001-fix-makefile.patch
|
22
++++++++++++++++++++++
A
pkgs/usbtan-cli/default.nix
|
31
+++++++++++++++++++++++++++++++
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
@@ -20,4 +20,5 @@ final: prev:
   matrix-sliding-sync    = final.callPackage ./matrix-sliding-sync.nix {};
   mastoFE-standalone     = final.callPackage ./masto-fe-standalone {};
 
+  usbtan-cli             = final.callPackage ./usbtan-cli {};
 }
diff --git a/pkgs/usbtan-cli/0001-fix-makefile.patch b/pkgs/usbtan-cli/0001-fix-makefile.patch
@@ -0,0 +1,22 @@
+From f658e3b29691e6403f93c8b11bb0738a9506c5a8 Mon Sep 17 00:00:00 2001
+From: "Leah (ctucx)" <git@ctu.cx>
+Date: Sat, 16 Mar 2024 15:39:09 +0100
+Subject: [PATCH] fix makefile
+
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index bf4001f..c86330a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,2 +1,2 @@
+ usbtan-cli: main.c
+-	gcc -DENABLE_CLI -o usbtan-cli main.c -I/usr/include/gwenhywfar5/ -I/usr/include/libchipcard5/  `pkg-config --cflags --libs glib-2.0` -lgwenhywfar
+\ No newline at end of file
++	gcc -DENABLE_CLI -o usbtan-cli main.c `pkg-config --cflags --libs glib-2.0 gwenhywfar libchipcard-server`
+\ No newline at end of file
+-- 
+2.42.0
+
diff --git a/pkgs/usbtan-cli/default.nix b/pkgs/usbtan-cli/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, applyPatches, fetchFromGitHub, pkg-config, glib, gwenhywfar, libchipcard, ... }:
+
+stdenv.mkDerivation rec {
+  pname = "usbtan-cli";
+  version = "0.0.0";
+
+  src = applyPatches {
+    src = fetchFromGitHub {
+      owner = "hoehermann";
+      repo = pname;
+      rev = "8aa2e0098ff3c21c966f46fcccf7ca9addc18228";
+      sha256 = "sha256-thjquaSStf+RF12xvxVS6NtCFpF/voEIZO5ArVtPHl8";
+    };
+    patches = [
+      ./0001-fix-makefile.patch
+    ];
+  };
+
+  nativeBuildInputs = [ pkg-config glib libchipcard gwenhywfar ];
+
+  shellHook = ''
+    export PKG_CONFIG_PATH=${glib}/lib/pkgconfig/:${gwenhywfar}/lib/pkgconfig/:${libchipcard}/lib/pkgconfig
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp usbtan-cli $out/bin/usbtan-cli
+  '';
+
+}+
\ No newline at end of file