mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-03 20:33:21 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
86 lines
2.7 KiB
Nix
86 lines
2.7 KiB
Nix
{ 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.hostPlatform.isLinux then
|
|
{
|
|
src = fetchurl {
|
|
url = "https://github.com/revoltchat/desktop/releases/download/v${version}/Revolt-linux.AppImage";
|
|
hash = "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/revolt-desktop
|
|
cp -a ${final.appimageContents}/revolt-desktop.desktop $out/share/applications/revolt-desktop.desktop
|
|
cp -a ${final.appimageContents}/usr/share/icons $out/share/icons
|
|
|
|
substituteInPlace $out/share/applications/revolt-desktop.desktop \
|
|
--replace 'Exec=AppRun' 'Exec=revolt-desktop'
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postFixup = ''
|
|
makeWrapper ${electron}/bin/electron $out/bin/revolt-desktop \
|
|
--add-flags $out/share/revolt-desktop/resources/app.asar \
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}"
|
|
'';
|
|
}
|
|
else
|
|
assert stdenvNoCC.hostPlatform.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/revolt-desktop"
|
|
|
|
runHook postInstall
|
|
'';
|
|
}
|
|
)
|