-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7938d40
commit 1aa2b72
Showing
1 changed file
with
66 additions
and
43 deletions.
There are no files selected for viewing
109 changes: 66 additions & 43 deletions
109
pkgs/applications/networking/instant-messengers/revolt-desktop/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,85 @@ | ||
{ stdenv | ||
{ stdenvNoCC | ||
, lib | ||
, fetchurl | ||
, fetchzip | ||
, appimageTools | ||
, makeWrapper | ||
, electron | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
(stdenvNoCC.mkDerivation { | ||
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="; | ||
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 { | ||
name = "${pname}-${version}"; | ||
inherit src; | ||
}; | ||
appimageContents = appimageTools.extractType2 { inherit (final) src pname version; }; | ||
|
||
dontUnpack = true; | ||
dontConfigure = true; | ||
dontBuild = true; | ||
dontUnpack = true; | ||
|
||
nativeBuildInputs = [ | ||
makeWrapper | ||
]; | ||
installPhase = '' | ||
runHook preInstall | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/bin $out/share/{applications,revolt-desktop} | ||
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 | ||
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}' | ||
substituteInPlace $out/share/applications/${pname}.desktop \ | ||
--replace 'Exec=AppRun' 'Exec=${pname}' | ||
runHook postInstall | ||
''; | ||
|
||
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; | ||
}; | ||
|
||
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}}" | ||
''; | ||
installPhase = '' | ||
runHook preInstall | ||
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"; | ||
}; | ||
} | ||
mkdir -p "$out/Applications/" "$out/bin/" | ||
mv Revolt.app "$out/Applications/" | ||
makeWrapper "$out/Applications/Revolt.app/Contents/MacOS/Revolt" "$out/bin/${pname}" | ||
runHook postInstall | ||
''; | ||
} | ||
) |