lib.packagesFromDirectoryRecursive: Improved documentation (#359898)
[NixPkgs.git] / pkgs / tools / misc / yubikey-manager-qt / default.nix
blobce0d06bb089a25a13aefd90891b1bc77121feed7
1 { lib
2 , mkDerivation
3 , fetchurl
4 , imagemagick
5 , pcsclite
6 , pyotherside
7 , python3
8 , qmake
9 , qtbase
10 , qtgraphicaleffects
11 , qtquickcontrols2
12 , yubikey-manager
13 , yubikey-personalization
16 mkDerivation rec {
17   pname = "yubikey-manager-qt";
18   version = "1.2.5";
20   src = fetchurl {
21     url = "https://developers.yubico.com/yubikey-manager-qt/Releases/yubikey-manager-qt-${version}.tar.gz";
22     hash = "sha256-6bKeR3UX2DhXGcKJ1bxvT1aLTgCfc+aNo6ckE89NV+I=";
23   };
25   nativeBuildInputs = [
26     python3.pkgs.wrapPython
27     qmake
28     imagemagick
29   ];
31   postPatch = ''
32     substituteInPlace ykman-gui/deployment.pri --replace '/usr/bin' "$out/bin"
33   '';
35   buildInputs = [
36     pyotherside
37     python3
38     qtbase
39     qtgraphicaleffects
40     qtquickcontrols2
41   ];
43   pythonPath = [
44     (yubikey-manager.override { python3Packages = python3.pkgs; })
45   ];
47   postInstall = ''
48     # Desktop files
49     install -D -m0644 resources/ykman-gui.desktop "$out/share/applications/ykman-gui.desktop"
50     substituteInPlace "$out/share/applications/ykman-gui.desktop" \
51       --replace Exec=ykman-gui "Exec=$out/bin/ykman-gui"
53     # Icons
54     install -Dt $out/share/ykman-gui/icons resources/icons/*.{icns,ico}
55     install -D -m0644 resources/icons/ykman.png "$out/share/icons/hicolor/128x128/apps/ykman.png"
56     ln -s -- "$out/share/icons/hicolor/128x128/apps/ykman.png" "$out/share/icons/hicolor/128x128/apps/ykman-gui.png"
57     for SIZE in 16 24 32 48 64 96; do
58       # set modify/create for reproducible builds
59       convert -scale ''${SIZE} +set date:create +set date:modify \
60         resources/icons/ykman.png ykman.png
62       imageFolder="$out/share/icons/hicolor/''${SIZE}x''${SIZE}/apps"
63       install -D -m0644 ykman.png "$imageFolder/ykman.png"
64       ln -s -- "$imageFolder/ykman.png" "$imageFolder/ykman-gui.png"
65     done
66     unset SIZE imageFolder
67   '';
69   qtWrapperArgs = [
70     "--prefix" "LD_LIBRARY_PATH" ":" (lib.makeLibraryPath [ pcsclite yubikey-personalization ])
71   ];
73   preFixup = ''
74     buildPythonPath "$pythonPath"
75     qtWrapperArgs+=(--prefix PYTHONPATH : "$program_PYTHONPATH")
76   '';
78   meta = with lib; {
79     description = "Cross-platform application for configuring any YubiKey over all USB interfaces";
80     homepage = "https://developers.yubico.com/yubikey-manager-qt/";
81     license = licenses.bsd2;
82     maintainers = [ maintainers.cbley ];
83     mainProgram = "ykman-gui";
84     platforms = platforms.linux;
85   };