From ccaa736c45510015f175537ffd6b57b8759529b0 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 12 Jun 2024 23:12:24 +0200 Subject: [PATCH 1/5] cryptor: add desktop item --- pkgs/by-name/cr/cryptor/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/cr/cryptor/package.nix b/pkgs/by-name/cr/cryptor/package.nix index edbaa0903b0a..b48662b2992f 100644 --- a/pkgs/by-name/cr/cryptor/package.nix +++ b/pkgs/by-name/cr/cryptor/package.nix @@ -42,6 +42,10 @@ stdenv.mkDerivation (finalAttrs: { postInstall = '' wrapProgram $out/bin/cryptor \ --prefix PATH : "${lib.makeBinPath [ gocryptfs ]}" + + install -Dm444 $src/resources/misc/cryptor.desktop -t $out/share/applications + substituteInPlace $out/share/applications/cryptor.desktop \ + --replace-warn '/usr/bin/cryptor' 'cryptor' ''; meta = { From 7e3f2952c1a29c176c52644b51668b5b1c1795bd Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 12 Jun 2024 23:12:37 +0200 Subject: [PATCH 2/5] show-midi: add desktop item --- pkgs/by-name/sh/show-midi/package.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/sh/show-midi/package.nix b/pkgs/by-name/sh/show-midi/package.nix index 4e3029921321..f3f64967e627 100644 --- a/pkgs/by-name/sh/show-midi/package.nix +++ b/pkgs/by-name/sh/show-midi/package.nix @@ -9,6 +9,8 @@ , libXinerama , libXext , libXcursor +, makeDesktopItem +, copyDesktopItems }: stdenv.mkDerivation (finalAttrs: { @@ -23,7 +25,10 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ + pkg-config + copyDesktopItems + ]; buildInputs = [ alsa-lib freetype @@ -53,6 +58,8 @@ stdenv.mkDerivation (finalAttrs: { install -Dt $out/share/ShowMIDI/themes Themes/* + install -D Design/icon.png $out/share/icons/hicolor/1024x1024/apps/show-midi.png + mkdir -p $out/bin $out/lib/lv2 $out/lib/vst3 cd Builds/LinuxMakefile/build/ cp -r ShowMIDI.lv2 $out/lib/lv2 @@ -62,6 +69,16 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; + desktopItems = [(makeDesktopItem { + name = "ShowMIDI"; + exec = finalAttrs.meta.mainProgram; + comment = finalAttrs.meta.description; + type = "Application"; + icon = "show-midi"; + desktopName = "ShowMIDI"; + categories = [ "Audio" ]; + })]; + # JUCE dlopens these, make sure they are in rpath # Otherwise, segfault will happen env.NIX_LDFLAGS = toString [ From e9c34b282ae1da76931b72068850d5361ce9c698 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 12 Jun 2024 23:12:49 +0200 Subject: [PATCH 3/5] zxtune: add desktop item --- pkgs/by-name/zx/zxtune/package.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/zx/zxtune/package.nix b/pkgs/by-name/zx/zxtune/package.nix index e406afbb681b..11a283a4eb2b 100644 --- a/pkgs/by-name/zx/zxtune/package.nix +++ b/pkgs/by-name/zx/zxtune/package.nix @@ -25,6 +25,8 @@ , withQt ? true , qt5 , zip +, makeDesktopItem +, copyDesktopItems }: let dlopenBuildInputs = [] @@ -58,7 +60,11 @@ in stdenv.mkDerivation rec { strictDeps = true; - nativeBuildInputs = lib.optionals withQt [ zip qt5.wrapQtAppsHook ]; + nativeBuildInputs = lib.optionals withQt [ + zip + qt5.wrapQtAppsHook + copyDesktopItems + ]; buildInputs = staticBuildInputs ++ dlopenBuildInputs; @@ -118,6 +124,7 @@ in stdenv.mkDerivation rec { install -Dm755 bin/linux/release/zxtune123 -t $out/bin '' + lib.optionalString withQt '' install -Dm755 bin/linux/release/zxtune-qt -t $out/bin + install -Dm755 apps/zxtune-qt/res/theme_default/zxtune.png -t $out/share/icons/hicolor/48x48/apps '' + '' runHook postInstall ''; @@ -128,6 +135,17 @@ in stdenv.mkDerivation rec { wrapQtApp "$out/bin/zxtune-qt" ''; + desktopItems = lib.optionals withQt [(makeDesktopItem { + name = "ZXTune"; + exec = "zxtune-qt"; + icon = "zxtune"; + desktopName = "ZXTune"; + genericName = "ZXTune"; + comment = meta.description; + categories = [ "Audio" ]; + type = "Application"; + })]; + meta = with lib; { description = "Crossplatform chiptunes player"; longDescription = '' From e51e07e4be829c04814eba458e5dbfe69a8ad421 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 12 Jun 2024 23:22:04 +0200 Subject: [PATCH 4/5] yt-dlg: install desktop item --- pkgs/by-name/yt/yt-dlg/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/yt/yt-dlg/package.nix b/pkgs/by-name/yt/yt-dlg/package.nix index e245cba7c2a2..8cc4d65b2a91 100644 --- a/pkgs/by-name/yt/yt-dlg/package.nix +++ b/pkgs/by-name/yt/yt-dlg/package.nix @@ -40,6 +40,11 @@ python3Packages.buildPythonApplication rec { wxpython ]; + postInstall = '' + install -Dm444 yt-dlg.desktop -t $out/share/applications + cp -r youtube_dl_gui/data/* $out/share + ''; + meta = { description = "Cross platform front-end GUI of the popular youtube-dl written in wxPython"; homepage = "https://oleksis.github.io/youtube-dl-gui"; From 53961c0aa6cca79aba022ae9a413b4823d418d0b Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 12 Jun 2024 23:32:04 +0200 Subject: [PATCH 5/5] unciv: install icon for desktop item --- pkgs/by-name/un/unciv/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/un/unciv/package.nix b/pkgs/by-name/un/unciv/package.nix index ab6ba743e75c..2f41aa57ecba 100644 --- a/pkgs/by-name/un/unciv/package.nix +++ b/pkgs/by-name/un/unciv/package.nix @@ -15,9 +15,15 @@ let exec = "unciv"; comment = "An open-source Android/Desktop remake of Civ V"; desktopName = "Unciv"; + icon = "unciv"; categories = [ "Game" ]; }; + desktopIcon = fetchurl { + url = "https://github.com/yairm210/Unciv/blob/4.11.16/extraImages/Icons/Unciv%20icon%20v6.png?raw=true"; + hash = "sha256-Zuz+HGfxjGviGBKTiHdIFXF8UMRLEIfM8f+LIB/xonk="; + }; + envLibPath = lib.makeLibraryPath (lib.optionals stdenv.isLinux [ libGL libpulseaudio @@ -46,6 +52,8 @@ stdenv.mkDerivation rec { --prefix PATH : ${lib.makeBinPath [ jre ]} \ --add-flags "-jar ${src}" + install -Dm444 ${desktopIcon} $out/share/icons/hicolor/512x512/apps/unciv.png + runHook postInstall '';