2020-08-12 19:17:35 +01:00
|
|
|
|
{ stdenv, lib, fetchurl, buildEnv, makeWrapper
|
2017-08-03 01:30:42 +01:00
|
|
|
|
|
2018-07-21 01:44:44 +01:00
|
|
|
|
, xorg, alsaLib, dbus, glib, gtk3, atk, pango, freetype, fontconfig
|
2019-05-22 12:03:39 +01:00
|
|
|
|
, gdk-pixbuf, cairo, nss, nspr, gconf, expat, systemd, libcap
|
2017-08-03 01:30:42 +01:00
|
|
|
|
, libnotify
|
2020-06-07 13:39:09 +01:00
|
|
|
|
, ffmpeg_3, libxcb, cups
|
2017-08-03 01:30:42 +01:00
|
|
|
|
, sqlite, udev
|
2018-10-02 09:24:05 +01:00
|
|
|
|
, libuuid
|
|
|
|
|
, sdk ? false
|
2017-08-03 01:30:42 +01:00
|
|
|
|
}:
|
|
|
|
|
let
|
2018-08-20 20:11:29 +01:00
|
|
|
|
bits = if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
|
2017-08-03 01:30:42 +01:00
|
|
|
|
else "ia32";
|
|
|
|
|
|
|
|
|
|
nwEnv = buildEnv {
|
|
|
|
|
name = "nwjs-env";
|
|
|
|
|
paths = [
|
2019-05-22 12:03:39 +01:00
|
|
|
|
xorg.libX11 xorg.libXrender glib /*gtk2*/ gtk3 atk pango cairo gdk-pixbuf
|
2017-08-03 01:30:42 +01:00
|
|
|
|
freetype fontconfig xorg.libXcomposite alsaLib xorg.libXdamage
|
|
|
|
|
xorg.libXext xorg.libXfixes nss nspr gconf expat dbus
|
|
|
|
|
xorg.libXtst xorg.libXi xorg.libXcursor xorg.libXrandr
|
|
|
|
|
xorg.libXScrnSaver cups
|
|
|
|
|
libcap libnotify
|
|
|
|
|
# libnw-specific (not chromium dependencies)
|
2020-06-07 13:39:09 +01:00
|
|
|
|
ffmpeg_3 libxcb
|
2017-08-03 01:30:42 +01:00
|
|
|
|
# chromium runtime deps (dlopen’d)
|
|
|
|
|
sqlite udev
|
2018-10-02 09:24:05 +01:00
|
|
|
|
libuuid
|
2017-08-03 01:30:42 +01:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
extraOutputsToInstall = [ "lib" "out" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
|
pname = "nwjs";
|
2018-10-02 09:24:05 +01:00
|
|
|
|
version = "0.33.4";
|
2017-08-03 01:30:42 +01:00
|
|
|
|
|
2018-10-02 09:24:05 +01:00
|
|
|
|
src = if sdk then fetchurl {
|
|
|
|
|
url = "https://dl.nwjs.io/v${version}/nwjs-sdk-v${version}-linux-${bits}.tar.gz";
|
|
|
|
|
sha256 = if bits == "x64" then
|
|
|
|
|
"1hi6xispxvyb6krm5j11mv8509dwpw5ikpbkvq135gsk3gm29c9y" else
|
|
|
|
|
"00p4clbfinrj5gp2i84a263l3h00z8g7mnx61qwmr0z02kvswz9s";
|
|
|
|
|
} else fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
|
url = "https://dl.nwjs.io/v${version}/nwjs-v${version}-linux-${bits}.tar.gz";
|
2017-08-03 01:30:42 +01:00
|
|
|
|
sha256 = if bits == "x64" then
|
2018-10-02 09:24:05 +01:00
|
|
|
|
"09zd6gja3l20xx03h2gawpmh9f8nxqjp8qdkds5nz9kbbckhkj52" else
|
|
|
|
|
"0nlpdz76k1p1pq4xygfr2an91m0d7p5fjyg2xhiggyy8b7sp4964";
|
2017-08-03 01:30:42 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
phases = [ "unpackPhase" "installPhase" ];
|
|
|
|
|
|
|
|
|
|
# we have runtime deps like sqlite3 that should remain
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
|
let ccPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ];
|
|
|
|
|
in ''
|
|
|
|
|
mkdir -p $out/share/nwjs
|
|
|
|
|
cp -R * $out/share/nwjs
|
|
|
|
|
find $out/share/nwjs
|
|
|
|
|
|
|
|
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/share/nwjs/nw
|
|
|
|
|
|
2020-08-12 19:17:35 +01:00
|
|
|
|
ln -s ${lib.getLib systemd}/lib/libudev.so $out/share/nwjs/libudev.so.0
|
2017-08-03 01:30:42 +01:00
|
|
|
|
|
|
|
|
|
libpath="$out/share/nwjs/lib/"
|
|
|
|
|
for f in "$libpath"/*.so; do
|
|
|
|
|
patchelf --set-rpath "${nwEnv}/lib:${ccPath}:$libpath" "$f"
|
|
|
|
|
done
|
|
|
|
|
patchelf --set-rpath "${nwEnv}/lib:${nwEnv}/lib64:${ccPath}:$libpath" $out/share/nwjs/nw
|
|
|
|
|
# check, whether all RPATHs are correct (all dependencies found)
|
|
|
|
|
checkfile=$(mktemp)
|
|
|
|
|
for f in "$libpath"/*.so "$out/share/nwjs/nw"; do
|
|
|
|
|
(echo "$f:";
|
|
|
|
|
ldd "$f" ) > "$checkfile"
|
|
|
|
|
done
|
|
|
|
|
if <"$checkfile" grep -e "not found"; then
|
|
|
|
|
cat "$checkfile"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
ln -s $out/share/nwjs/nw $out/bin
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
|
description = "An app runtime based on Chromium and node.js";
|
2020-04-01 02:11:51 +01:00
|
|
|
|
homepage = "https://nwjs.io/";
|
2017-08-03 01:30:42 +01:00
|
|
|
|
platforms = ["i686-linux" "x86_64-linux"];
|
|
|
|
|
maintainers = [ maintainers.offline ];
|
|
|
|
|
license = licenses.bsd3;
|
|
|
|
|
};
|
|
|
|
|
}
|