2020-04-04 22:23:14 +01:00
|
|
|
{ pkgs, stdenv, fetchFromGitHub, makeWrapper, makeDesktopItem, electron_7, riot-web, mkYarnPackage }:
|
2019-03-30 22:57:59 +00:00
|
|
|
|
2019-08-26 18:07:24 +01:00
|
|
|
# Notes for maintainers:
|
|
|
|
# * versions of `riot-web` and `riot-desktop` should be kept in sync.
|
|
|
|
# * the Yarn dependency expression must be updated with `./update-riot-desktop.sh <git release tag>`
|
2019-03-18 01:59:57 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
executableName = "riot-desktop";
|
2020-04-01 15:53:16 +01:00
|
|
|
version = "1.5.15";
|
2019-03-18 01:59:57 +00:00
|
|
|
riot-web-src = fetchFromGitHub {
|
|
|
|
owner = "vector-im";
|
|
|
|
repo = "riot-web";
|
|
|
|
rev = "v${version}";
|
2020-04-01 15:53:16 +01:00
|
|
|
sha256 = "08yk5is6n9ci1jml0b94a3swdybx01k5klbl30i1b76biyn75m77";
|
2019-03-18 01:59:57 +00:00
|
|
|
};
|
2020-03-05 22:16:31 +00:00
|
|
|
electron = electron_7;
|
2019-03-18 01:59:57 +00:00
|
|
|
|
2019-10-20 21:32:31 +01:00
|
|
|
in mkYarnPackage rec {
|
2019-03-18 01:59:57 +00:00
|
|
|
name = "riot-desktop-${version}";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = "${riot-web-src}/electron_app";
|
|
|
|
|
|
|
|
packageJSON = ./riot-desktop-package.json;
|
|
|
|
yarnNix = ./riot-desktop-yarndeps.nix;
|
|
|
|
|
2020-04-04 22:23:14 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2019-03-18 01:59:57 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# resources
|
|
|
|
mkdir -p "$out/share/riot"
|
|
|
|
ln -s '${riot-web}' "$out/share/riot/webapp"
|
2019-08-26 18:07:24 +01:00
|
|
|
cp -r './deps/riot-web' "$out/share/riot/electron"
|
2019-11-08 15:44:21 +00:00
|
|
|
cp -r './deps/riot-web/img' "$out/share/riot"
|
2019-08-26 18:07:24 +01:00
|
|
|
rm "$out/share/riot/electron/node_modules"
|
|
|
|
cp -r './node_modules' "$out/share/riot/electron"
|
2019-03-18 01:59:57 +00:00
|
|
|
|
|
|
|
# icons
|
|
|
|
for icon in $out/share/riot/electron/build/icons/*.png; do
|
|
|
|
mkdir -p "$out/share/icons/hicolor/$(basename $icon .png)/apps"
|
|
|
|
ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png)/apps/riot.png"
|
|
|
|
done
|
|
|
|
|
|
|
|
# desktop item
|
|
|
|
mkdir -p "$out/share"
|
|
|
|
ln -s "${desktopItem}/share/applications" "$out/share/applications"
|
|
|
|
|
|
|
|
# executable wrapper
|
2020-03-05 22:16:31 +00:00
|
|
|
makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \
|
2020-04-04 22:23:14 +01:00
|
|
|
--add-flags "$out/share/riot/electron"
|
2019-03-18 01:59:57 +00:00
|
|
|
'';
|
|
|
|
|
2019-03-30 22:57:59 +00:00
|
|
|
# Do not attempt generating a tarball for riot-web again.
|
|
|
|
# note: `doDist = false;` does not work.
|
|
|
|
distPhase = ''
|
|
|
|
true
|
|
|
|
'';
|
|
|
|
|
2019-03-18 01:59:57 +00:00
|
|
|
# The desktop item properties should be kept in sync with data from upstream:
|
|
|
|
# * productName and description from
|
|
|
|
# https://github.com/vector-im/riot-web/blob/develop/electron_app/package.json
|
|
|
|
# * category and StartupWMClass from the build.linux section of
|
|
|
|
# https://github.com/vector-im/riot-web/blob/develop/package.json
|
|
|
|
desktopItem = makeDesktopItem {
|
2019-08-19 11:40:26 +01:00
|
|
|
name = "riot";
|
2019-03-18 01:59:57 +00:00
|
|
|
exec = executableName;
|
|
|
|
icon = "riot";
|
|
|
|
desktopName = "Riot";
|
|
|
|
genericName = "Matrix Client";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = "Network;InstantMessaging;Chat;";
|
|
|
|
extraEntries = ''
|
2020-03-28 22:37:24 +00:00
|
|
|
StartupWMClass=riot
|
2019-03-18 01:59:57 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A feature-rich client for Matrix.org";
|
|
|
|
homepage = https://about.riot.im/;
|
|
|
|
license = licenses.asl20;
|
2019-07-21 02:29:09 +01:00
|
|
|
maintainers = with maintainers; [ pacien worldofpeace ];
|
2020-03-05 22:16:31 +00:00
|
|
|
inherit (electron.meta) platforms;
|
2019-03-18 01:59:57 +00:00
|
|
|
};
|
|
|
|
}
|