Merge pull request #320128 from thecaralice/revolt

revolt-desktop: darwin support
This commit is contained in:
Masum Reza 2024-06-23 21:30:04 +05:30 committed by GitHub
commit 5a8409db96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 85 additions and 64 deletions

View File

@ -1,62 +0,0 @@
{ stdenv
, lib
, fetchurl
, appimageTools
, makeWrapper
, electron
}:
stdenv.mkDerivation rec {
pname = "revolt-desktop";
version = "1.0.6";
src = fetchurl {
url = "https://github.com/revoltchat/desktop/releases/download/v${version}/Revolt-linux.AppImage";
sha256 = "sha256-Wsm6ef2Reenq3/aKGaP2yzlOuLKaxKtRHCLLMxvWUUY=";
};
appimageContents = appimageTools.extractType2 {
name = "${pname}-${version}";
inherit src;
};
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [
makeWrapper
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/{applications,revolt-desktop}
cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
cp -a ${appimageContents}/revolt-desktop.desktop $out/share/applications/${pname}.desktop
cp -a ${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}}"
'';
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 ];
platforms = platforms.linux;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
mainProgram = "revolt-desktop";
};
}

View File

@ -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
'';
}
)

View File

@ -12061,8 +12061,6 @@ with pkgs;
raysession = python3Packages.callPackage ../applications/audio/raysession {};
revolt-desktop = callPackage ../applications/networking/instant-messengers/revolt-desktop { };
rbw = callPackage ../tools/security/rbw { };
remarshal = with python3Packages; toPythonApplication remarshal;