rocketchat-desktop: build from source, update
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"@rollup/rollup-android-arm-eabi@npm:4.9.6": "0c2f9b26ec12048da21048a2005fb85b82918066eba3066fd55e1d3b3aaaa948d48e4a5bdaf01e783fc302cfd14248af305c2ab678e3601751dcc9cb34a90280",
|
||||
"@rollup/rollup-android-arm64@npm:4.9.6": "1e971371a8b472db35c43078c620d72a45807e005f7ba981cbc02f477c1871b670462860b8591f55c784fe4755812cb62449b52280e7727edd44030a5f722287",
|
||||
"@rollup/rollup-darwin-arm64@npm:4.9.6": "f0f3a11e6b1c9f86c1be8e6c349395713f01ad304ca698c27634132a06400d4caf76ab8d3b2e93ce42917c4bd1940ed0989565af57af9c3bba9af9afe13828a8",
|
||||
"@rollup/rollup-darwin-x64@npm:4.9.6": "aabb57c3e53c104ce9246f52293f3d6fa3593105e425da7e58b68e3f0e2b19c48cbcf1cdf6420e646297703bc2f07de4134cd456f3c98cb8a694c67c2e438b09",
|
||||
"@rollup/rollup-linux-arm-gnueabihf@npm:4.9.6": "f2279ec807463905bb37d417a4f460037fe464eba8cfc3b0e360dc681922ba7918986c0537adecb4c6f669e3c959fc557f90a83b4bf135a277163461282199fd",
|
||||
"@rollup/rollup-linux-arm64-gnu@npm:4.9.6": "628d62f3db2344f27b10d6efe0d0aae1f1215d3a1f69c36b76f7413afd87bdfd973efac38757c06348111047367acdb5027a49d720250846a4bf6591700728d3",
|
||||
"@rollup/rollup-linux-arm64-musl@npm:4.9.6": "deda2d49fa48dd5b128b5de1250646f9f1f6475ba2ea850989eb53b998caf7807a3b60d088650313ae7acacac5c275e10dbe6e45b652f66a8560f83c21ceb39b",
|
||||
"@rollup/rollup-linux-riscv64-gnu@npm:4.9.6": "f83d37dfc8626c3a39202ce395868bb7042c8213a0f0c05047ac90e83c734c3850e8047467d22517e0b069745d1f3a1963a8910c19ac1e332ad2a9ede7124642",
|
||||
"@rollup/rollup-linux-x64-gnu@npm:4.9.6": "422d2d719db0cc4aba06312102514ec84fa5f7b0a9899ea803275dd7562616e84ba2b022cc8816cb2d6378caa228f3de9d74658bb253e5071b41ea47d19e6f15",
|
||||
"@rollup/rollup-linux-x64-musl@npm:4.9.6": "9c4299965b36bb8a2b36c58039b9e3855d8dccaeb6514e498b4c55af89b2bda9e381e07739b860f3b63fc11395815cfe74abe636101efaaec3bad8182bba640f",
|
||||
"@rollup/rollup-win32-arm64-msvc@npm:4.9.6": "4f5cb68d8ee166083e0c2d95f28823ca70031675953a776de929e4d65401eb1bc98e06c329c442a7a80250ddd4ec8da74af5610d6c6322143d16888bf2968145",
|
||||
"@rollup/rollup-win32-ia32-msvc@npm:4.9.6": "17aa37afe754006c6b5dce3191a2dcb9442694bac6c67457acaeb7397ca8029bb173c95aa8cef85a4d5a986a055807f217a46bcb09d0549f12c6d90bd8a1ad15",
|
||||
"@rollup/rollup-win32-x64-msvc@npm:4.9.6": "9bf08c01d9da090f59de86904228990dbd74f2ade598d19f0684135acdb711f233cd532ab7ee96c7368a68c40942c8c34d868b83e3146ba97b20e8065dece8e0",
|
||||
"dmg-license@npm:1.0.11": "36c0a7b030801b91216affa9b2bb00caa345b2327f298accb2263a80a0320ca305f90b99da68007d187c830c543410d58a0a2bbc229e8d169b0e1d1652ff42aa",
|
||||
"iconv-corefoundation@npm:1.1.7": "0189733ef51a9f481379202cb1919f2677efc44aa014ba662a6fd99e47993e350eab0ff724ed18cda8011c9b78c4702b2d374f732955f1def3fd2a14a29d25c0"
|
||||
}
|
||||
@@ -1,104 +1,148 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
pkgs,
|
||||
fetchurl,
|
||||
wrapGAppsHook3,
|
||||
fetchFromGitHub,
|
||||
yarn-berry,
|
||||
nodejs,
|
||||
pkg-config,
|
||||
node-gyp,
|
||||
python3Packages,
|
||||
electron_39,
|
||||
vips,
|
||||
xvfb-run,
|
||||
copyDesktopItems,
|
||||
makeDesktopItem,
|
||||
makeWrapper,
|
||||
nix-update-script,
|
||||
}:
|
||||
let
|
||||
libPathNative = { packages }: lib.makeLibraryPath packages;
|
||||
electron = electron_39;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "rocketchat-desktop";
|
||||
version = "4.9.1";
|
||||
version = "4.10.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/RocketChat/Rocket.Chat.Electron/releases/download/${version}/rocketchat-${version}-linux-amd64.deb";
|
||||
hash = "sha256-71B5EqsMVGsTvrdl4gLW3O+7/xy2DNv/zROg2CfXl1E=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "RocketChat";
|
||||
repo = "Rocket.Chat.Electron";
|
||||
tag = version;
|
||||
hash = "sha256-ZEjhYjMcCA2ABNfcwe7JbYCoTBHr+geyMSSh6ceBt5g=";
|
||||
};
|
||||
|
||||
# This might need to be updated between releases.
|
||||
# See https://nixos.org/manual/nixpkgs/stable/#javascript-yarnBerry-missing-hashes
|
||||
missingHashes = ./missing-hashes.json;
|
||||
|
||||
offlineCache = yarn-berry.fetchYarnBerryDeps {
|
||||
inherit src missingHashes;
|
||||
hash = "sha256-ZAb8zDdxsJYRD6LRhtFS8XRc8NbstJbUyaQCbvSdKSg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
wrapGAppsHook3 # to fully work with gnome also needs programs.dconf.enable = true in your configuration.nix
|
||||
yarn-berry.yarnBerryConfigHook
|
||||
yarn-berry
|
||||
nodejs # needed for rollup
|
||||
# needed for vips compilation for the JS sharp dependency
|
||||
pkg-config
|
||||
node-gyp
|
||||
python3Packages.python
|
||||
python3Packages.distutils
|
||||
# install phase helpers
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
gtk3
|
||||
stdenv.cc.cc
|
||||
zlib
|
||||
glib
|
||||
dbus
|
||||
atk
|
||||
pango
|
||||
freetype
|
||||
libgnome-keyring
|
||||
fontconfig
|
||||
gdk-pixbuf
|
||||
cairo
|
||||
cups
|
||||
expat
|
||||
libgpg-error
|
||||
alsa-lib
|
||||
nspr
|
||||
nss
|
||||
xorg.libXrender
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXdamage
|
||||
xorg.libXtst
|
||||
xorg.libXcomposite
|
||||
xorg.libXi
|
||||
xorg.libXfixes
|
||||
xorg.libXrandr
|
||||
xorg.libXcursor
|
||||
xorg.libxkbfile
|
||||
xorg.libXScrnSaver
|
||||
systemd
|
||||
libnotify
|
||||
xorg.libxcb
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
libdbusmenu
|
||||
libdrm
|
||||
libgbm
|
||||
xorg.libxshmfence
|
||||
libxkbcommon
|
||||
buildInputs = [
|
||||
vips
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
|
||||
unpackPhase = ''
|
||||
ar p $src data.tar.xz | tar xJ ./opt/ ./usr/
|
||||
postPatch = ''
|
||||
# Avoid downloading a changing file during the `rollup` build
|
||||
substituteInPlace rollup.config.mjs \
|
||||
--replace-fail 'downloadSupportedVersions(),' ""
|
||||
'';
|
||||
|
||||
env = {
|
||||
PUPPETEER_SKIP_DOWNLOAD = "1";
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||
ELECTRON_OVERRIDE_DIST_PATH = electron.dist;
|
||||
NODE_ENV = "production";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
yarn build
|
||||
|
||||
# electronDist needs to be writable
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
yarn electron-builder \
|
||||
--config electron-builder.json \
|
||||
--dir \
|
||||
-c.electronDist=electron-dist \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
xvfb-run
|
||||
];
|
||||
|
||||
checkPhase = "yarn test";
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
type = "Application";
|
||||
categories = [
|
||||
"GNOME"
|
||||
"GTK"
|
||||
"Network"
|
||||
"InstantMessaging"
|
||||
];
|
||||
name = pname;
|
||||
desktopName = "Rocket.Chat";
|
||||
genericName = "Rocket.Chat";
|
||||
comment = "Official Desktop Client for Rocket.Chat";
|
||||
icon = pname;
|
||||
exec = meta.mainProgram;
|
||||
terminal = false;
|
||||
startupWMClass = "Rocket.Chat";
|
||||
mimeTypes = [ "x-scheme-handler/rocketchat" ];
|
||||
})
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
mv opt $out
|
||||
mv usr/share $out
|
||||
ln -s $out/opt/Rocket.Chat/rocketchat-desktop $out/bin/rocketchat-desktop
|
||||
|
||||
mkdir -p $out/bin $out/share/applications
|
||||
|
||||
cp -a dist/*-unpacked/resources $out/share/${pname}
|
||||
|
||||
for icon in build/icons/*.png
|
||||
do
|
||||
install -Dm644 $icon $out/share/icons/hicolor/$(basename ''${icon%.png})/apps/${pname}.png
|
||||
done
|
||||
|
||||
makeWrapper '${lib.getExe electron}' $out/bin/${meta.mainProgram} \
|
||||
--set-default ELECTRON_IS_DEV 0 \
|
||||
--add-flags $out/share/${pname}/app.asar \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup =
|
||||
let
|
||||
libpath = libPathNative { packages = buildInputs; };
|
||||
in
|
||||
''
|
||||
app=$out/opt/Rocket.Chat
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${libpath}:$app" \
|
||||
$app/rocketchat-desktop
|
||||
sed -i -e "s|Exec=.*$|Exec=$out/bin/rocketchat-desktop|" $out/share/applications/rocketchat-desktop.desktop
|
||||
'';
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Official Desktop client for Rocket.Chat";
|
||||
mainProgram = "rocketchat-desktop";
|
||||
homepage = "https://github.com/RocketChat/Rocket.Chat.Electron";
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
changelog = "https://github.com/RocketChat/Rocket.Chat.Electron/releases/tag/${src.tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with lib.maintainers; [ mynacol ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user