about summary refs log tree commit diff
path: root/pkgs/tools/misc/yubikey-manager-qt
diff options
context:
space:
mode:
authorTom Wieczorek <tom@bibbu.net>2022-06-28 09:16:32 +0200
committerTom Wieczorek <twieczorek@mirantis.com>2022-06-28 09:16:32 +0200
commit403e43366cbaaa164116327de27474f8fab36a85 (patch)
tree1dd5f293dfd868a7b0fef8baf30c36c1a80371d1 /pkgs/tools/misc/yubikey-manager-qt
parentb90fa9940b6adb82d4fe07b025cca21daf6b58d1 (diff)
yubikey-manager-qt: fix application icons
Copy the icons into the canonical XDG icon folders and autogenerate
smaller sizes from the main icon file.
Diffstat (limited to 'pkgs/tools/misc/yubikey-manager-qt')
-rw-r--r--pkgs/tools/misc/yubikey-manager-qt/default.nix25
1 files changed, 21 insertions, 4 deletions
diff --git a/pkgs/tools/misc/yubikey-manager-qt/default.nix b/pkgs/tools/misc/yubikey-manager-qt/default.nix
index 0a5ccda2cedf4..a193075633d06 100644
--- a/pkgs/tools/misc/yubikey-manager-qt/default.nix
+++ b/pkgs/tools/misc/yubikey-manager-qt/default.nix
@@ -1,6 +1,7 @@
 { lib
 , mkDerivation
 , fetchurl
+, imagemagick
 , pcsclite
 , pyotherside
 , python3
@@ -24,6 +25,7 @@ mkDerivation rec {
   nativeBuildInputs = [
     python3.pkgs.wrapPython
     qmake
+    imagemagick
   ];
 
   postPatch = ''
@@ -43,10 +45,25 @@ mkDerivation rec {
   ];
 
   postInstall = ''
-    install -Dt $out/share/applications resources/ykman-gui.desktop
-    install -Dt $out/share/ykman-gui/icons resources/icons/*.{icns,ico,png,xpm}
-    substituteInPlace $out/share/applications/ykman-gui.desktop \
-      --replace 'Exec=ykman-gui' "Exec=$out/bin/ykman-gui"
+    # Desktop files
+    install -D -m0644 resources/ykman-gui.desktop "$out/share/applications/ykman-gui.desktop"
+    substituteInPlace "$out/share/applications/ykman-gui.desktop" \
+      --replace Exec=ykman-gui "Exec=$out/bin/ykman-gui"
+
+    # Icons
+    install -Dt $out/share/ykman-gui/icons resources/icons/*.{icns,ico}
+    install -D -m0644 resources/icons/ykman.png "$out/share/icons/hicolor/128x128/apps/ykman.png"
+    ln -s -- "$out/share/icons/hicolor/128x128/apps/ykman.png" "$out/share/icons/hicolor/128x128/apps/ykman-gui.png"
+    for SIZE in 16 24 32 48 64 96; do
+      # set modify/create for reproducible builds
+      convert -scale ''${SIZE} +set date:create +set date:modify \
+        resources/icons/ykman.png ykman.png
+
+      imageFolder="$out/share/icons/hicolor/''${SIZE}x''${SIZE}/apps"
+      install -D -m0644 ykman.png "$imageFolder/ykman.png"
+      ln -s -- "$imageFolder/ykman.png" "$imageFolder/ykman-gui.png"
+    done
+    unset SIZE imageFolder
   '';
 
   qtWrapperArgs = [