nixpkgs/pkgs/development/tools/nwjs/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

150 lines
3.1 KiB
Nix
Raw Normal View History

2023-11-06 13:03:02 +00:00
{ alsa-lib
, at-spi2-core
, atk
, autoPatchelfHook
, buildEnv
, cairo
, cups
, dbus
, expat
, fetchurl
, ffmpeg
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, lib
, libcap
, libdrm
, libnotify
2018-10-02 08:24:05 +00:00
, libuuid
2023-11-06 13:03:02 +00:00
, libxcb
, libxkbcommon
, makeWrapper
, mesa
, nspr
, nss
, pango
2018-10-02 08:24:05 +00:00
, sdk ? false
2023-11-06 13:03:02 +00:00
, sqlite
, stdenv
, systemd
, udev
, xorg
}:
2023-11-06 13:03:02 +00:00
let
2023-11-06 13:03:02 +00:00
bits = if stdenv.hostPlatform.system == "x86_64-linux" then "x64" else "ia32";
nwEnv = buildEnv {
name = "nwjs-env";
paths = [
2023-11-06 13:03:02 +00:00
alsa-lib
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libcap
libdrm
libnotify
libxkbcommon
2023-11-06 13:03:02 +00:00
mesa
nspr
nss
pango
xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libxshmfence
# libnw-specific (not chromium dependencies)
2023-11-06 13:03:02 +00:00
ffmpeg
libxcb
# chromium runtime deps (dlopend)
2018-10-02 08:24:05 +00:00
libuuid
2023-11-06 13:03:02 +00:00
sqlite
udev
];
extraOutputsToInstall = [ "lib" "out" ];
};
2023-11-06 13:03:02 +00:00
in
stdenv.mkDerivation rec {
pname = "nwjs";
2023-10-21 19:31:23 +00:00
version = "0.82.0";
2023-11-06 13:03:02 +00:00
src =
let flavor = if sdk then "sdk-" else "";
in fetchurl {
url = "https://dl.nwjs.io/v${version}/nwjs-${flavor}v${version}-linux-${bits}.tar.gz";
hash = {
"sdk-ia32" = "sha256-aIRnZDslOhoD5F0coX43VNFWGEImPU5oq9Roc4jYfsY=";
"sdk-x64" = "sha256-rKbnNAq9AVjSUjTipYze2VHiVi0RnZZsdQj1725DPd0=";
"ia32" = "sha256-pA53+A+EtS7m6026jPlC3vFxb2iheS4peDJFNkQAf/s=";
"x64" = "sha256-hRih8o8hBbYBEes3Z62PSMIC720SLRa3t2rL/5LaJAE=";
}."${flavor + bits}";
};
2023-10-21 19:31:23 +00:00
nativeBuildInputs = [ makeWrapper autoPatchelfHook ];
runtimeDependencies = [ sqlite libuuid udev ];
installPhase =
let ccPath = lib.makeLibraryPath [ stdenv.cc.cc ];
2023-11-06 13:03:02 +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
ln -s ${lib.getLib systemd}/lib/libudev.so $out/share/nwjs/libudev.so.0
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
2023-11-06 13:03:02 +00:00
'';
meta = with lib; {
description = "An app runtime based on Chromium and node.js";
homepage = "https://nwjs.io/";
2023-11-06 13:03:02 +00:00
platforms = [ "i686-linux" "x86_64-linux" ];
maintainers = [ maintainers.offline ];
license = licenses.bsd3;
};
}