1{
2 lib,
3 stdenv,
4 buildPythonApplication,
5 fetchFromGitHub,
6 poetry-core,
7 fido2,
8 nitrokey,
9 pyside6,
10 usb-monitor,
11 qt6,
12}:
13
14let
15 inherit (qt6)
16 wrapQtAppsHook
17 qtbase
18 qtwayland
19 qtsvg
20 ;
21in
22
23buildPythonApplication rec {
24 pname = "nitrokey-app2";
25 version = "2.4.1";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "Nitrokey";
30 repo = "nitrokey-app2";
31 tag = "v${version}";
32 hash = "sha256-nzhhtnKKOHA+Cw1y+BpYsyQklzkDnmFRKGIfaJ/dmaQ=";
33 };
34
35 nativeBuildInputs = [
36 wrapQtAppsHook
37 ];
38
39 buildInputs = [
40 qtbase
41 ]
42 ++ lib.optionals stdenv.hostPlatform.isLinux [
43 qtwayland
44 qtsvg
45 ];
46
47 build-system = [
48 poetry-core
49 ];
50
51 dependencies = [
52 fido2
53 nitrokey
54 pyside6
55 usb-monitor
56 ];
57
58 pythonRelaxDeps = [ "nitrokey" ];
59
60 pythonImportsCheck = [
61 "nitrokeyapp"
62 ];
63
64 postInstall = ''
65 install -Dm755 meta/com.nitrokey.nitrokey-app2.desktop $out/share/applications/com.nitrokey.nitrokey-app2.desktop
66 install -Dm755 meta/nk-app2.png $out/share/icons/hicolor/128x128/apps/com.nitrokey.nitrokey-app2.png
67 '';
68
69 # wrapQtApps only wrapps binary files and normally skips python programs.
70 # Manually pass the qtWrapperArgs from wrapQtAppsHook to wrap python programs.
71 preFixup = ''
72 makeWrapperArgs+=("''${qtWrapperArgs[@]}")
73 '';
74
75 meta = with lib; {
76 description = "This application allows to manage Nitrokey 3 devices";
77 homepage = "https://github.com/Nitrokey/nitrokey-app2";
78 changelog = "https://github.com/Nitrokey/nitrokey-app2/releases/tag/${src.tag}";
79 license = licenses.asl20;
80 maintainers = with maintainers; [
81 _999eagle
82 panicgh
83 ];
84 mainProgram = "nitrokeyapp";
85 };
86}