{lib, ...}: { perSystem = {pkgs, ...}: { packages.t3code = pkgs.appimageTools.wrapType2 rec { pname = "t3code"; version = "0.0.13"; src = pkgs.fetchurl { url = "https://github.com/pingdotgg/t3code/releases/download/v${version}/T3-Code-${version}-x86_64.AppImage"; hash = "sha256-oHKIh+aHsbGVHEoLLjItl6AbVRwvWVlZaIWyHKiekVc="; }; extraInstallCommands = let contents = pkgs.appimageTools.extract {inherit pname version src;}; in '' desktop_file=$(find ${contents} -name "*.desktop" | head -n1) if [ -n "$desktop_file" ]; then install -m 444 -D "$desktop_file" "$out/share/applications/${pname}.desktop" substituteInPlace "$out/share/applications/${pname}.desktop" \ --replace 'Exec=AppRun' 'Exec=${pname}' \ --replace 'Exec=T3-Code' 'Exec=${pname}' \ --replace 'Exec=t3-code' 'Exec=${pname}' || true fi if [ -d ${contents}/usr/share/icons ]; then cp -r ${contents}/usr/share/icons $out/share fi ''; meta = { description = "T3 Chat Desktop"; homepage = "https://t3.codes"; license = lib.licenses.mit; platforms = ["x86_64-linux"]; }; }; }; }