From 99baa239215a1b83060d631474e416148062f78f Mon Sep 17 00:00:00 2001 From: 7karni <7karni@proton.me> Date: Mon, 17 Nov 2025 03:10:43 +0530 Subject: [PATCH] added icon to sunvox desktop entry on linux, png fetched from website and resized to various sizes using imagemagick --- pkgs/by-name/su/sunvox/package.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/by-name/su/sunvox/package.nix b/pkgs/by-name/su/sunvox/package.nix index 4afee56add8f..633aeeba301c 100644 --- a/pkgs/by-name/su/sunvox/package.nix +++ b/pkgs/by-name/su/sunvox/package.nix @@ -12,6 +12,8 @@ makeDesktopItem, makeWrapper, SDL2, + fetchurl, + imagemagick, }: let platforms = { @@ -25,6 +27,11 @@ let bindir = platforms."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + icon = fetchurl { + url = "https://warmplace.ru/soft/sunvox/images/icon.png"; + hash = "sha256-ld2GCOhBhMThuUYBNa+2iTdY2HsYBRyApWiHTPuVgKA="; + }; + in stdenv.mkDerivation (finalAttrs: { pname = "sunvox"; @@ -43,6 +50,7 @@ stdenv.mkDerivation (finalAttrs: { lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook copyDesktopItems + imagemagick ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper @@ -67,6 +75,7 @@ stdenv.mkDerivation (finalAttrs: { desktopName = "SunVox"; genericName = "Modular Synthesizer"; comment = "Modular synthesizer with pattern-based sequencer"; + icon = "sunvox"; categories = [ "AudioVideo" "Audio" @@ -96,6 +105,14 @@ stdenv.mkDerivation (finalAttrs: { # Cleanup, make sure we didn't miss anything find $out/share/sunvox/sunvox -type f -name readme.txt -delete rmdir $out/share/sunvox/sunvox/${bindir} $out/share/sunvox/sunvox + + # Resize & install icons + for size in 16 24 32 48 64 128 256; do + mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps + magick ${icon} -resize ''${size}x''${size} \ + $out/share/icons/hicolor/''${size}x''${size}/apps/sunvox.png + done + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' mkdir $out/Applications