rambox: don't build from sources

This commit is contained in:
gnidorah 2020-02-21 18:25:21 +03:00
parent 1462612de1
commit f5b761175f
7 changed files with 36 additions and 207 deletions

View File

@ -1,56 +0,0 @@
{ stdenv, fetchFromGitHub, fetchNodeModules, nodejs-10_x, ruby, sencha
, auth0ClientID, auth0Domain }:
stdenv.mkDerivation rec {
pname = "rambox-bare";
version = "0.7.3";
src = fetchFromGitHub {
owner = "ramboxapp";
repo = "community-edition";
rev = version;
sha256 = "03pwzyij2i5m23qzhyqdcipixmqj46qbjmq626swwqy03a0p91qv";
};
nativeBuildInputs = [ nodejs-10_x ruby sencha ];
node_modules = fetchNodeModules {
inherit src;
nodejs = nodejs-10_x;
sha256 = "05vb0r0q3ckg2g87fsm22j0cbfvk81q5z43zwmrzh3pb3zh54xj1";
};
patches = [ ./isDev.patch ];
configurePhase = ''
echo 'var auth0Cfg = { clientID: "${auth0ClientID}", domain: "${auth0Domain}" };' > env.js
ln -s ${node_modules} node_modules
'';
buildPhase = ''
mkdir ../rambox-build
npm run sencha:compile:build
'';
installPhase = ''
mv ../rambox-build/ $out
# https://github.com/saenzramiro/rambox/issues/1281
echo '{"name": "rambox", "version": "${version}", "main": "electron/main.js"}' > $out/package.json
# https://github.com/saenzramiro/rambox/issues/1282
cp --parents ext/packages/ext-locale/build/ext-locale-*.js $out
# Symbolic link causes `Uncaught Error: Cannot find module 'immutable'`
cp -r ${node_modules} $out/node_modules
'';
meta = with stdenv.lib; {
description = "Messaging and emailing app that combines common web applications into one";
homepage = http://rambox.pro;
license = licenses.gpl3;
maintainers = with maintainers; [ gnidorah ];
platforms = platforms.linux;
};
}

View File

@ -1,52 +1,50 @@
{ stdenv, newScope, makeWrapper
, electron, xdg_utils, makeDesktopItem
, auth0ClientID ? "0spuNKfIGeLAQ_Iki9t3fGxbfJl3k8SU"
, auth0Domain ? "nixpkgs.auth0.com" }:
{ stdenv, fetchurl, xdg_utils, dpkg, makeWrapper, autoPatchelfHook
, libXtst, libXScrnSaver, gtk3, nss, alsaLib, udev, libnotify
}:
let
callPackage = newScope self;
self = {
fetchNodeModules = callPackage ./fetchNodeModules.nix {};
rambox-bare = callPackage ./bare.nix {
inherit auth0ClientID auth0Domain;
version = "0.7.3";
in stdenv.mkDerivation rec {
pname = "rambox";
inherit version;
src = {
x86_64-linux = fetchurl {
url = "https://github.com/ramboxapp/community-edition/releases/download/${version}/Rambox-${version}-linux-amd64.deb";
sha256 = "09v8zlayas906zhqy2aw4wkvyl87ykr09sjf0nmgmf69piwmjgg6";
};
sencha = callPackage ./sencha {};
};
desktopItem = makeDesktopItem rec {
name = "Rambox";
exec = "rambox";
icon = "${self.rambox-bare}/resources/Icon.png";
desktopName = name;
genericName = "Rambox messenger";
categories = "Network;";
};
in
i686-linux = fetchurl {
url = "https://github.com/ramboxapp/community-edition/releases/download/${version}/Rambox-${version}-linux-i386.deb";
sha256 = "0gv4pf3vhrw4xyccm24ivv92d9qy4zpwsh0m82ib1w764lyxmyrz";
};
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
with self;
nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook ];
buildInputs = [ libXtst libXScrnSaver gtk3 nss alsaLib ];
runtimeDependencies = [ udev.lib libnotify ];
stdenv.mkDerivation {
name = "rambox-${rambox-bare.version}";
nativeBuildInputs = [ makeWrapper ];
dontUnpack = true;
dontWrapGApps = true; # we only want $gappsWrapperArgs here
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
runHook preInstall
mkdir -p $out/share/applications
ln -s ${desktopItem}/share/applications/* $out/share/applications
runHook postInstall
mkdir -p $out/bin
cp -r opt $out
ln -s $out/opt/Rambox/rambox $out/bin
# provide resources
cp -r usr/share $out
substituteInPlace $out/share/applications/rambox.desktop \
--replace Exec=/opt/Rambox/rambox Exec=rambox
'';
postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/rambox \
--add-flags "${rambox-bare} --without-update" \
--prefix PATH : ${xdg_utils}/bin
wrapProgram $out/opt/Rambox/rambox --prefix PATH : ${xdg_utils}/bin
'';
meta = rambox-bare.meta // {
platforms = [ "i686-linux" "x86_64-linux" ];
meta = with stdenv.lib; {
description = "Free and Open Source messaging and emailing app that combines common web applications into one";
homepage = http://rambox.pro;
license = licenses.mit;
maintainers = [ maintainers.gnidorah ];
platforms = ["i686-linux" "x86_64-linux"];
hydraPlatforms = [];
};
}

View File

@ -1,26 +0,0 @@
{ stdenv, jq }: { src, nodejs, sha256 }:
# Only npm >= 5.4.2 is deterministic, see:
# https://github.com/npm/npm/issues/17979#issuecomment-332701215
assert stdenv.lib.versionAtLeast nodejs.version "8.9.0";
stdenv.mkDerivation {
name = "node_modules";
outputHashAlgo = "sha256";
outputHash = sha256;
outputHashMode = "recursive";
nativeBuildInputs = [ jq nodejs ];
buildCommand = ''
cp -r ${src}/* .
HOME=. npm install --force --ignore-scripts --only=production
for f in $(find node_modules -name package.json); do
# https://github.com/npm/npm/issues/10393
jq -S 'delpaths(keys | map(select(startswith("_")) | [.]))' $f > $f.tmp
mv $f.tmp $f
done
mv node_modules $out
'';
}

View File

@ -1,14 +0,0 @@
https://github.com/saenzramiro/rambox/issues/1280
diff -urNZ a/electron/main.js b/electron/main.js
--- a/electron/main.js 2017-11-02 14:58:06.085127616 +0000
+++ b/electron/main.js 2017-11-02 14:58:18.316887679 +0000
@@ -8,7 +8,7 @@
// Configuration
const Config = require('electron-config');
// Development
-const isDev = require('electron-is-dev');
+const isDev = false;
// Updater
const updater = require('./updater');
// File System

View File

@ -1,43 +0,0 @@
{ stdenv, fetchurl, gzip, which, unzip, jdk }:
let
version = "6.6.0.13";
srcs = {
i686-linux = fetchurl {
url = "https://cdn.sencha.com/cmd/${version}/no-jre/SenchaCmd-${version}-linux-i386.sh.zip";
sha256 = "15b197108b49mf0afpihkh3p68lxm7580zz2w0xsbahglnvhwyfz";
};
x86_64-linux = fetchurl {
url = "https://cdn.sencha.com/cmd/${version}/no-jre/SenchaCmd-${version}-linux-amd64.sh.zip";
sha256 = "1cxhckmx1802p9qiw09cgb1v5f30wcvnrwkshmia8p8n0q47lpp4";
};
};
in
stdenv.mkDerivation {
inherit version;
pname = "sencha-bare";
src = srcs.${stdenv.hostPlatform.system};
nativeBuildInputs = [ gzip which unzip ];
buildInputs = [ jdk ];
sourceRoot = ".";
configurePhase = ''
substituteAll ${./response.varfile} response.varfile
'';
installPhase = ''
./SenchaCmd*.sh -q -dir $out -varfile response.varfile
# disallow sencha writing into /nix/store/repo
echo "repo.local.dir=$TMP/repo" >> $out/sencha.cfg
rm $out/shell-wrapper.sh $out/Uninstaller
'';
meta = with stdenv.lib; {
license = licenses.unfree;
platforms = attrNames srcs;
};
}

View File

@ -1,17 +0,0 @@
{ stdenv, callPackage, makeWrapper }:
let
sencha-bare = callPackage ./bare.nix {};
in
stdenv.mkDerivation {
name = "sencha-${sencha-bare.version}";
nativeBuildInputs = [ makeWrapper ];
dontUnpack = true;
installPhase = ''
makeWrapper ${sencha-bare}/sencha $out/bin/sencha
'';
}

View File

@ -1,13 +0,0 @@
addToPath$Integer=1
parentDir=.
sys.adminRights$Boolean=false
sys.component.148$Boolean=true
sys.component.157$Boolean=true
sys.component.26$Boolean=true
sys.component.30$Boolean=true
sys.component.90$Boolean=true
sys.component.91$Boolean=true
sys.component.92$Boolean=true
sys.component.94$Boolean=true
sys.installationDir=@out@
sys.languageId=en