diff options
author | Masum Reza <50095635+JohnRTitor@users.noreply.github.com> | 2024-06-23 21:30:04 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 21:30:04 +0530 |
commit | 5a8409db9613199fbb2145cd11be4f2fc860ee9b (patch) | |
tree | b2ff6d7f88458d98f612645cc5aea6465e24fbf4 /pkgs/by-name/re | |
parent | 2616284fdf48928b311f7c0a025c0cf5d286aae5 (diff) | |
parent | da2e0f92dc9a0d25394540d184630bce21fcf6a8 (diff) |
Merge pull request #320128 from thecaralice/revolt
revolt-desktop: darwin support
Diffstat (limited to 'pkgs/by-name/re')
-rw-r--r-- | pkgs/by-name/re/revolt-desktop/package.nix | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/by-name/re/revolt-desktop/package.nix b/pkgs/by-name/re/revolt-desktop/package.nix new file mode 100644 index 0000000000000..6a7461f3b13ea --- /dev/null +++ b/pkgs/by-name/re/revolt-desktop/package.nix @@ -0,0 +1,85 @@ +{ stdenvNoCC +, lib +, fetchurl +, fetchzip +, appimageTools +, makeWrapper +, electron +}: +(stdenvNoCC.mkDerivation { + pname = "revolt-desktop"; + version = "1.0.6"; + dontConfigure = true; + dontBuild = true; + meta = with lib; { + description = "Open source user-first chat platform"; + homepage = "https://revolt.chat/"; + changelog = "https://github.com/revoltchat/desktop/releases/tag/v${version}"; + license = licenses.agpl3Only; + maintainers = with maintainers; [ + heyimnova + caralice + ]; + platforms = platforms.linux ++ platforms.darwin; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + mainProgram = "revolt-desktop"; + }; + nativeBuildInputs = [ makeWrapper ]; +}).overrideAttrs + ( + final: prev: + let + inherit (prev) pname version; + in + if stdenvNoCC.isLinux then + { + src = fetchurl { + url = "https://github.com/revoltchat/desktop/releases/download/v${version}/Revolt-linux.AppImage"; + sha256 = "sha256-Wsm6ef2Reenq3/aKGaP2yzlOuLKaxKtRHCLLMxvWUUY="; + }; + + appimageContents = appimageTools.extractType2 { inherit (final) src pname version; }; + + dontUnpack = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin $out/share/{applications,revolt-desktop} + + cp -a ${final.appimageContents}/{locales,resources} $out/share/${pname} + cp -a ${final.appimageContents}/revolt-desktop.desktop $out/share/applications/${pname}.desktop + cp -a ${final.appimageContents}/usr/share/icons $out/share/icons + + substituteInPlace $out/share/applications/${pname}.desktop \ + --replace 'Exec=AppRun' 'Exec=${pname}' + + runHook postInstall + ''; + + postFixup = '' + makeWrapper ${electron}/bin/electron $out/bin/${pname} \ + --add-flags $out/share/${pname}/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" + ''; + } + else + assert stdenvNoCC.isDarwin; + { + src = fetchzip { + url = "https://github.com/revoltchat/desktop/releases/download/v${version}/Revolt-${version}-mac.zip"; + hash = "sha256-XxmKcIfJtHfi6SahrRHMeTAuyVqiN9Yhayjis10vD2w="; + stripRoot = false; + }; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/Applications/" "$out/bin/" + mv Revolt.app "$out/Applications/" + makeWrapper "$out/Applications/Revolt.app/Contents/MacOS/Revolt" "$out/bin/${pname}" + + runHook postInstall + ''; + } + ) |