2019-03-30 22:57:59 +00:00
|
|
|
{ pkgs, stdenv, fetchFromGitHub, makeWrapper, makeDesktopItem, electron, riot-web }:
|
|
|
|
|
2019-05-02 23:59:48 +01:00
|
|
|
# Note for maintainers:
|
|
|
|
# Versions of `riot-web` and `riot-desktop` should be kept in sync.
|
|
|
|
|
2019-03-30 22:57:59 +00:00
|
|
|
with (import ./yarn2nix.nix { inherit pkgs; });
|
2019-03-18 01:59:57 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
executableName = "riot-desktop";
|
2019-07-19 21:13:48 +01:00
|
|
|
version = "1.3.0";
|
2019-03-18 01:59:57 +00:00
|
|
|
riot-web-src = fetchFromGitHub {
|
|
|
|
owner = "vector-im";
|
|
|
|
repo = "riot-web";
|
|
|
|
rev = "v${version}";
|
2019-07-19 21:13:48 +01:00
|
|
|
sha256 = "00142b0zcnwfdgvb84k2a0amyb67j3mm0d8p191aqk3bxv1xpxk1";
|
2019-03-18 01:59:57 +00:00
|
|
|
};
|
|
|
|
|
2019-03-30 22:57:59 +00:00
|
|
|
in mkYarnPackage rec {
|
2019-03-18 01:59:57 +00:00
|
|
|
name = "riot-desktop-${version}";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = "${riot-web-src}/electron_app";
|
|
|
|
|
|
|
|
# The package manifest should be copied on each update of this package.
|
|
|
|
# > cp ${riot-web-src}/electron_app/package.json riot-desktop-package.json
|
|
|
|
packageJSON = ./riot-desktop-package.json;
|
|
|
|
|
|
|
|
# The dependency expression can be regenerated using nixos.yarn2nix with the following command:
|
|
|
|
# > yarn2nix --lockfile=${riot-web-src}/electron_app/yarn.lock > riot-desktop-yarndeps.nix
|
|
|
|
yarnNix = ./riot-desktop-yarndeps.nix;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# resources
|
|
|
|
mkdir -p "$out/share/riot"
|
|
|
|
ln -s '${riot-web}' "$out/share/riot/webapp"
|
|
|
|
cp -r '${riot-web-src}/origin_migrator' "$out/share/riot/origin_migrator"
|
|
|
|
cp -r '.' "$out/share/riot/electron"
|
|
|
|
|
|
|
|
# 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
|
|
|
|
makeWrapper '${electron}/bin/electron' "$out/bin/${executableName}" \
|
|
|
|
--add-flags "$out/share/riot/electron"
|
|
|
|
'';
|
|
|
|
|
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 {
|
|
|
|
inherit name;
|
|
|
|
exec = executableName;
|
|
|
|
icon = "riot";
|
|
|
|
desktopName = "Riot";
|
|
|
|
genericName = "Matrix Client";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = "Network;InstantMessaging;Chat;";
|
|
|
|
extraEntries = ''
|
|
|
|
StartupWMClass="riot"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
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 ];
|
2019-03-18 01:59:57 +00:00
|
|
|
inherit (electron.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|