Merge pull request #31137 from yegortimoshenko/rambox/build-from-source

rambox: build from source

authored by Jörg Thalheim and committed by GitHub 1925b4c1 27c8fd24

+223 -54
+61
pkgs/applications/networking/instant-messengers/rambox/bare.nix
···
··· 1 + { stdenv, fetchFromGitHub, fetchNodeModules, nodejs-8_x, ruby, sencha }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "rambox-bare-${version}"; 5 + version = "0.5.13"; 6 + 7 + src = fetchFromGitHub { 8 + owner = "saenzramiro"; 9 + repo = "rambox"; 10 + rev = version; 11 + sha256 = "0c770a9z017y6gcrpyri7s1gifm8zi5f29bq5nvh3zzg4wgqh326"; 12 + }; 13 + 14 + nativeBuildInputs = [ nodejs-8_x ruby sencha ]; 15 + 16 + node_modules = fetchNodeModules { 17 + inherit src; 18 + 19 + nodejs = nodejs-8_x; 20 + sha256 = "1y3q8ggyvfywxqi5hn9mvr1sjfylspis43iyf4b7snyr1a1br3r4"; 21 + }; 22 + 23 + patches = [ ./hide-check-for-updates.patch ./isDev.patch ]; 24 + 25 + # These credentials are only for this derivation. If you want to get credentials 26 + # for another distribution, go to https://auth0.com. If you want to reuse the same 27 + # domain, drop a line at yegortimoshenko@gmail.com! 28 + auth0ClientID = "0spuNKfIGeLAQ_Iki9t3fGxbfJl3k8SU"; 29 + auth0Domain = "nixpkgs.auth0.com"; 30 + 31 + configurePhase = '' 32 + echo 'var auth0Cfg = { clientID: "${auth0ClientID}", domain: "${auth0Domain}" };' > env.js 33 + ln -s ${node_modules} node_modules 34 + ''; 35 + 36 + buildPhase = '' 37 + mkdir ../rambox-build 38 + npm run sencha:compile:build 39 + ''; 40 + 41 + installPhase = '' 42 + mv ../rambox-build/ $out 43 + 44 + # https://github.com/saenzramiro/rambox/issues/1281 45 + echo '{"name": "rambox", "version": "${version}", "main": "electron/main.js"}' > $out/package.json 46 + 47 + # https://github.com/saenzramiro/rambox/issues/1282 48 + cp --parents ext/packages/ext-locale/build/ext-locale-*.js $out 49 + 50 + # Symbolic link causes `Uncaught Error: Cannot find module 'immutable'` 51 + cp -r ${node_modules} $out/node_modules 52 + ''; 53 + 54 + meta = with stdenv.lib; { 55 + description = "Messaging and emailing app that combines common web applications into one"; 56 + homepage = http://rambox.pro; 57 + license = licenses.gpl3; 58 + maintainers = with maintainers; [ gnidorah ]; 59 + platforms = platforms.linux; 60 + }; 61 + }
+16 -54
pkgs/applications/networking/instant-messengers/rambox/default.nix
··· 1 - { stdenv, fetchurl, dpkg, makeWrapper 2 - , xorg, gtk2, atk, glib, pango, gdk_pixbuf, cairo, freetype, fontconfig 3 - , gnome2, dbus, nss, nspr, alsaLib, cups, expat, udev, libnotify, xdg_utils }: 4 5 let 6 - bits = if stdenv.system == "x86_64-linux" then "x64" 7 - else "ia32"; 8 - 9 - version = "0.5.13"; 10 - 11 - runtimeDeps = [ 12 - udev libnotify 13 - ]; 14 - deps = (with xorg; [ 15 - libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes 16 - libXrender libX11 libXtst libXScrnSaver libxcb 17 - ]) ++ [ 18 - gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus 19 - gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc 20 - ] ++ runtimeDeps; 21 - in stdenv.mkDerivation rec { 22 - name = "rambox-${version}"; 23 - src = fetchurl { 24 - url = "https://github.com/saenzramiro/rambox/releases/download/${version}/Rambox_${version}-${bits}.deb"; 25 - sha256 = if bits == "x64" then 26 - "0bn562fr1wsnn3xsd4q2rrxi6c56vckrkfmjl2dqb30hpmj2vn0d" else 27 - "180ndvkil5mk5idwnn7spfygnhhll6pjc342pfzgmzk46a723qs4"; 28 }; 29 - 30 - # don't remove runtime deps 31 - dontPatchELF = true; 32 - 33 - buildInputs = [ dpkg makeWrapper ]; 34 35 - unpackPhase = "dpkg-deb -x $src ."; 36 37 - installPhase = '' 38 - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" opt/Rambox/rambox 39 - patchelf --set-rpath "$out/opt/Rambox:${stdenv.lib.makeLibraryPath deps}" opt/Rambox/rambox 40 41 - mkdir -p $out/bin 42 - cp -r opt $out 43 - ln -s $out/opt/Rambox/rambox $out/bin 44 45 - # provide resources 46 - cp -r usr/share $out 47 - substituteInPlace $out/share/applications/rambox.desktop \ 48 - --replace Exec=\"/opt/Rambox/rambox\" Exec=rambox 49 - ''; 50 51 - postFixup = '' 52 - paxmark m $out/opt/Rambox/rambox 53 - wrapProgram $out/opt/Rambox/rambox --prefix PATH : ${xdg_utils}/bin 54 ''; 55 - 56 - meta = with stdenv.lib; { 57 - description = "Free and Open Source messaging and emailing app that combines common web applications into one"; 58 - homepage = http://rambox.pro; 59 - license = licenses.mit; 60 - maintainers = [ maintainers.gnidorah ]; 61 - platforms = ["i686-linux" "x86_64-linux"]; 62 - hydraPlatforms = []; 63 - }; 64 }
··· 1 + { stdenv, newScope, makeWrapper, electron, xdg_utils }: 2 3 let 4 + callPackage = newScope self; 5 + self = { 6 + fetchNodeModules = callPackage ./fetchNodeModules.nix {}; 7 + rambox-bare = callPackage ./bare.nix {}; 8 + sencha = callPackage ./sencha {}; 9 }; 10 + in 11 12 + with self; 13 14 + stdenv.mkDerivation { 15 + name = "rambox-${rambox-bare.version}"; 16 17 + nativeBuildInputs = [ makeWrapper ]; 18 19 + unpackPhase = ":"; 20 21 + installPhase = '' 22 + makeWrapper ${electron}/bin/electron $out/bin/rambox \ 23 + --add-flags "${rambox-bare} --without-update" \ 24 + --prefix PATH : ${xdg_utils}/bin 25 ''; 26 }
+26
pkgs/applications/networking/instant-messengers/rambox/fetchNodeModules.nix
···
··· 1 + { stdenv, jq }: { src, nodejs, sha256 }: 2 + 3 + # Only npm >= 5.4.2 is deterministic, see: 4 + # https://github.com/npm/npm/issues/17979#issuecomment-332701215 5 + assert stdenv.lib.versionAtLeast nodejs.version "8.9.0"; 6 + 7 + stdenv.mkDerivation { 8 + name = "node_modules"; 9 + 10 + outputHashAlgo = "sha256"; 11 + outputHash = sha256; 12 + outputHashMode = "recursive"; 13 + 14 + nativeBuildInputs = [ jq nodejs ]; 15 + 16 + buildCommand = '' 17 + cp -r ${src}/* . 18 + HOME=. npm install --force --ignore-scripts --only=production 19 + for f in $(find node_modules -name package.json); do 20 + # https://github.com/npm/npm/issues/10393 21 + jq -S 'delpaths(keys | map(select(startswith("_")) | [.]))' $f > $f.tmp 22 + mv $f.tmp $f 23 + done 24 + mv node_modules $out 25 + ''; 26 + }
+35
pkgs/applications/networking/instant-messengers/rambox/hide-check-for-updates.patch
···
··· 1 + https://github.com/saenzramiro/rambox/issues/1283 2 + 3 + diff -urNZ a/electron/menu.js b/electron/menu.js 4 + --- a/electron/menu.js 2017-11-02 22:02:59.753119865 +0000 5 + +++ b/electron/menu.js 2017-11-02 22:08:34.419698562 +0000 6 + @@ -220,14 +220,6 @@ 7 + } 8 + }, 9 + { 10 + - label: locale['menu.help[5]'], 11 + - click(item, win) { 12 + - const webContents = win.webContents; 13 + - const send = webContents.send.bind(win.webContents); 14 + - send('autoUpdater:check-update'); 15 + - } 16 + - }, 17 + - { 18 + label: locale['menu.help[6]'], 19 + click() { 20 + sendAction('showAbout') 21 + @@ -290,14 +282,6 @@ 22 + type: 'separator' 23 + }); 24 + helpSubmenu.push({ 25 + - label: `&`+locale['menu.help[5]'], 26 + - click(item, win) { 27 + - const webContents = win.webContents; 28 + - const send = webContents.send.bind(win.webContents); 29 + - send('autoUpdater:check-update'); 30 + - } 31 + - }); 32 + - helpSubmenu.push({ 33 + label: `&`+locale['menu.help[6]'], 34 + click() { 35 + sendAction('showAbout')
+14
pkgs/applications/networking/instant-messengers/rambox/isDev.patch
···
··· 1 + https://github.com/saenzramiro/rambox/issues/1280 2 + 3 + diff -urNZ a/electron/main.js b/electron/main.js 4 + --- a/electron/main.js 2017-11-02 14:58:06.085127616 +0000 5 + +++ b/electron/main.js 2017-11-02 14:58:18.316887679 +0000 6 + @@ -8,7 +8,7 @@ 7 + // Configuration 8 + const Config = require('electron-config'); 9 + // Development 10 + -const isDev = require('electron-is-dev'); 11 + +const isDev = false; 12 + // Updater 13 + const updater = require('./updater'); 14 + // File System
+41
pkgs/applications/networking/instant-messengers/rambox/sencha/bare.nix
···
··· 1 + { stdenv, fetchurl, gzip, which, unzip, jdk }: 2 + 3 + let 4 + version = "6.5.2"; 5 + srcs = { 6 + i686-linux = fetchurl { 7 + url = "https://cdn.sencha.com/cmd/${version}/no-jre/SenchaCmd-${version}-linux-i386.sh.zip"; 8 + sha256 = "18gcqw9434xab97skcb97iw4p4s2pgggvq7jaisblap0ja00kqjr"; 9 + }; 10 + x86_64-linux = fetchurl { 11 + url = "https://cdn.sencha.com/cmd/${version}/no-jre/SenchaCmd-${version}-linux-amd64.sh.zip"; 12 + sha256 = "1b8jv99k37q1bi7b29f23lfzxc66v5fqdmr1rxsrqchwcrllc0z7"; 13 + }; 14 + }; 15 + in 16 + 17 + stdenv.mkDerivation rec { 18 + inherit version; 19 + 20 + name = "sencha-bare-${version}"; 21 + src = srcs.${stdenv.system}; 22 + 23 + nativeBuildInputs = [ gzip which unzip ]; 24 + buildInputs = [ jdk ]; 25 + 26 + sourceRoot = "."; 27 + 28 + configurePhase = '' 29 + substituteAll ${./response.varfile} response.varfile 30 + ''; 31 + 32 + installPhase = '' 33 + ./SenchaCmd*.sh -q -dir $out -varfile response.varfile 34 + rm $out/shell-wrapper.sh $out/Uninstaller 35 + ''; 36 + 37 + meta = with stdenv.lib; { 38 + license = licenses.unfree; 39 + platforms = attrNames srcs; 40 + }; 41 + }
+17
pkgs/applications/networking/instant-messengers/rambox/sencha/default.nix
···
··· 1 + { stdenv, callPackage, makeWrapper }: 2 + 3 + let 4 + sencha-bare = callPackage ./bare.nix {}; 5 + in 6 + 7 + stdenv.mkDerivation { 8 + name = "sencha-${sencha-bare.version}"; 9 + 10 + nativeBuildInputs = [ makeWrapper ]; 11 + 12 + unpackPhase = ":"; 13 + 14 + installPhase = '' 15 + makeWrapper ${sencha-bare}/sencha $out/bin/sencha 16 + ''; 17 + }
+13
pkgs/applications/networking/instant-messengers/rambox/sencha/response.varfile
···
··· 1 + addToPath$Integer=1 2 + parentDir=. 3 + sys.adminRights$Boolean=false 4 + sys.component.148$Boolean=true 5 + sys.component.157$Boolean=true 6 + sys.component.26$Boolean=true 7 + sys.component.30$Boolean=true 8 + sys.component.90$Boolean=true 9 + sys.component.91$Boolean=true 10 + sys.component.92$Boolean=true 11 + sys.component.94$Boolean=true 12 + sys.installationDir=@out@ 13 + sys.languageId=en