2020-08-12 18:17:35 +00:00
|
|
|
|
{ stdenv, lib, fetchurl, buildEnv, makeWrapper
|
2017-08-03 00:30:42 +00:00
|
|
|
|
|
2021-11-29 17:38:59 +00:00
|
|
|
|
, xorg, alsa-lib, at-spi2-core, dbus, glib, gtk3, atk, pango, freetype
|
2022-02-11 14:03:28 +00:00
|
|
|
|
, fontconfig , gdk-pixbuf, cairo, mesa, nss, nspr, expat, systemd
|
2021-11-29 17:38:59 +00:00
|
|
|
|
, libcap, libdrm, libxkbcommon
|
2017-08-03 00:30:42 +00:00
|
|
|
|
, libnotify
|
2021-05-20 11:46:01 +00:00
|
|
|
|
, ffmpeg, libxcb, cups
|
2017-08-03 00:30:42 +00:00
|
|
|
|
, sqlite, udev
|
2018-10-02 08:24:05 +00:00
|
|
|
|
, libuuid
|
|
|
|
|
, sdk ? false
|
2017-08-03 00:30:42 +00:00
|
|
|
|
}:
|
|
|
|
|
let
|
2018-08-20 19:11:29 +00:00
|
|
|
|
bits = if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
|
2017-08-03 00:30:42 +00:00
|
|
|
|
else "ia32";
|
|
|
|
|
|
|
|
|
|
nwEnv = buildEnv {
|
|
|
|
|
name = "nwjs-env";
|
|
|
|
|
paths = [
|
2021-11-29 17:38:59 +00:00
|
|
|
|
xorg.libX11 xorg.libXrender glib gtk3 atk at-spi2-core pango cairo gdk-pixbuf
|
2021-06-10 02:57:09 +00:00
|
|
|
|
freetype fontconfig xorg.libXcomposite alsa-lib xorg.libXdamage
|
2022-02-11 14:03:28 +00:00
|
|
|
|
xorg.libXext xorg.libXfixes mesa nss nspr expat dbus
|
2017-08-03 00:30:42 +00:00
|
|
|
|
xorg.libXtst xorg.libXi xorg.libXcursor xorg.libXrandr
|
2021-11-29 17:38:59 +00:00
|
|
|
|
xorg.libXScrnSaver xorg.libxshmfence cups
|
|
|
|
|
libcap libdrm libnotify
|
|
|
|
|
libxkbcommon
|
2017-08-03 00:30:42 +00:00
|
|
|
|
# libnw-specific (not chromium dependencies)
|
2021-05-20 11:46:01 +00:00
|
|
|
|
ffmpeg libxcb
|
2017-08-03 00:30:42 +00:00
|
|
|
|
# chromium runtime deps (dlopen’d)
|
|
|
|
|
sqlite udev
|
2018-10-02 08:24:05 +00:00
|
|
|
|
libuuid
|
2017-08-03 00:30:42 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
extraOutputsToInstall = [ "lib" "out" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
|
pname = "nwjs";
|
2021-11-29 17:38:59 +00:00
|
|
|
|
version = "0.54.1";
|
2017-08-03 00:30:42 +00:00
|
|
|
|
|
2018-10-02 08:24:05 +00: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
|
2021-11-29 17:38:59 +00:00
|
|
|
|
"sha256-1qeU4+EIki0M7yJPkRuzFwMdswfDOni5gltdmM6A/ds=" else
|
|
|
|
|
"sha256-wDEGePE9lrKa6OAzeiDLhVj992c0TJgiMHb8lJ4PF80=";
|
2018-10-02 08:24:05 +00:00
|
|
|
|
} else fetchurl {
|
2018-06-28 18:43:35 +00:00
|
|
|
|
url = "https://dl.nwjs.io/v${version}/nwjs-v${version}-linux-${bits}.tar.gz";
|
2017-08-03 00:30:42 +00:00
|
|
|
|
sha256 = if bits == "x64" then
|
2021-11-29 17:38:59 +00:00
|
|
|
|
"sha256-TACEM06K2t6dDXRD44lSW7GRi77yzSW4BZJw8gT+fl4=" else
|
|
|
|
|
"sha256-yX9knqFV5VQTT3TJDmQoDgt17NqH8fLt+bLQAqKleTU=";
|
2017-08-03 00:30:42 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# we have runtime deps like sqlite3 that should remain
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
|
|
|
|
|
installPhase =
|
2021-01-23 12:26:19 +00:00
|
|
|
|
let ccPath = lib.makeLibraryPath [ stdenv.cc.cc ];
|
2017-08-03 00:30:42 +00:00
|
|
|
|
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 18:17:35 +00:00
|
|
|
|
ln -s ${lib.getLib systemd}/lib/libudev.so $out/share/nwjs/libudev.so.0
|
2017-08-03 00:30:42 +00: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
|
2021-11-02 18:29:41 +00:00
|
|
|
|
|
|
|
|
|
mkdir $out/lib
|
|
|
|
|
ln -s $out/share/nwjs/lib/libnw.so $out/lib/libnw.so
|
2017-08-03 00:30:42 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2017-08-03 00:30:42 +00:00
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
|
meta = with lib; {
|
2017-08-03 00:30:42 +00:00
|
|
|
|
description = "An app runtime based on Chromium and node.js";
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "https://nwjs.io/";
|
2017-08-03 00:30:42 +00:00
|
|
|
|
platforms = ["i686-linux" "x86_64-linux"];
|
|
|
|
|
maintainers = [ maintainers.offline ];
|
|
|
|
|
license = licenses.bsd3;
|
|
|
|
|
};
|
|
|
|
|
}
|