nixpkgs/pkgs/by-name/mq/mqttx/package.nix
Martino Fontana 6e465f4550 treewide: fix use of extraPkgs in AppImages
Mostly removes unnecessary use of `extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs;`
This caused some packages to be listed twice.

Also, fix some styling, and accidental use of top-level packages (sometimes due to the `with;` keyword, e.g. on `beeper`).
Remove inclusions of `bash`, since `bashInteractive` is already present by default.
2024-05-13 20:35:07 +02:00

55 lines
1.7 KiB
Nix

{ lib
, stdenv
, fetchurl
, appimageTools
, imagemagick
}:
let
pname = "mqttx";
version = "1.9.9";
suffixedUrl = suffix: "https://github.com/emqx/MQTTX/releases/download/v${version}/MQTTX-${version}${suffix}.AppImage";
sources = {
"aarch64-linux" = fetchurl {
url = suffixedUrl "-arm64";
hash = "sha256-mCCRvLS6diKoKYZNUMsyiWyFWmyYYB0pAxNT0yriJHI=";
};
"x86_64-linux" = fetchurl {
url = suffixedUrl "";
hash = "sha256-InGfGiT3c5M8ueFZl5/hFmYRPeXnwSCUPhAqmz0jsU8=";
};
};
src = sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
appimageContents = appimageTools.extractType2 {
inherit pname version src;
};
in
appimageTools.wrapType2 {
inherit pname version src;
extraInstallCommands = ''
install -m 444 -D ${appimageContents}/${pname}.desktop $out/share/applications/${pname}.desktop
install -m 444 -D ${appimageContents}/${pname}.png $out/share/icons/hicolor/1024x1024/apps/${pname}.png
${imagemagick}/bin/convert ${appimageContents}/mqttx.png -resize 512x512 ${pname}_512.png
install -m 444 -D ${pname}_512.png $out/share/icons/hicolor/512x512/apps/${pname}.png
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
'';
meta = with lib; {
description = "Powerful cross-platform MQTT 5.0 Desktop, CLI, and WebSocket client tools";
homepage = "https://mqttx.app/";
changelog = "https://github.com/emqx/MQTTX/releases/tag/v${version}";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ gaelreyrol ];
mainProgram = "mqttx";
};
}