From c625e715f857ff2401658f0aa5b1e7c7681d0a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 20 Feb 2022 19:05:42 +0100 Subject: [PATCH] fluffychat: add .desktop --- .../instant-messengers/fluffychat/default.nix | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pkgs/applications/networking/instant-messengers/fluffychat/default.nix b/pkgs/applications/networking/instant-messengers/fluffychat/default.nix index 2e0f9a86e3d4..fdb822934383 100644 --- a/pkgs/applications/networking/instant-messengers/fluffychat/default.nix +++ b/pkgs/applications/networking/instant-messengers/fluffychat/default.nix @@ -2,6 +2,8 @@ , fetchFromGitLab , flutter , olm +, imagemagick +, makeDesktopItem }: flutter.mkFlutterApp rec { @@ -17,10 +19,23 @@ flutter.mkFlutterApp rec { hash = "sha256-PJH3jMQc6u9R6Snn+9rNN8t+8kt6l3Xt7zKPbpqj13E="; }; + desktopItem = makeDesktopItem { + name = "Fluffychat"; + exec = "@out@/bin/fluffychat"; + icon = "fluffychat"; + desktopName = "Fluffychat"; + genericName = "Chat with your friends (matrix client)"; + categories = "Chat;Network;InstantMessaging;"; + }; + buildInputs = [ olm ]; + nativeBuildInputs = [ + imagemagick + ]; + flutterExtraFetchCommands = '' M=$(echo $TMP/.pub-cache/hosted/pub.dartlang.org/matrix-*) sed -i $M/scripts/prepare.sh \ @@ -32,6 +47,24 @@ flutter.mkFlutterApp rec { popd ''; + postInstall = '' + FAV=$out/app/data/flutter_assets/assets/favicon.png + ICO=$out/share/icons + + install -D $FAV $ICO/fluffychat.png + mkdir $out/share/applications + cp $desktopItem/share/applications/*.desktop $out/share/applications + + for s in 24 32 42 64 128 256 512; do + D=$ICO/hicolor/''${s}x''${s}/apps + mkdir -p $D + convert $FAV -resize ''${s}x''${s} $D/fluffychat.png + done + + substituteInPlace $out/share/applications/*.desktop \ + --subst-var out + ''; + meta = with lib; { description = "Chat with your friends (matrix client)"; homepage = "https://fluffychat.im/";