2024-01-02 11:29:13 +00:00
{ alsa-lib
, at-spi2-core
, atk
, autoPatchelfHook
, buildEnv
2024-10-04 16:56:33 +00:00
, buildPackages
2024-01-02 11:29:13 +00:00
, cairo
, cups
, dbus
, expat
, fetchurl
, ffmpeg
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, lib
, libcap
, libdrm
2024-05-15 15:35:15 +00:00
, libGL
2020-04-24 23:36:52 +00:00
, libnotify
, libuuid
2024-01-02 11:29:13 +00:00
, libxcb
, libxkbcommon
, makeWrapper
, mesa
, nspr
, nss
, pango
2020-04-24 23:36:52 +00:00
, sdk ? false
2024-01-02 11:29:13 +00:00
, sqlite
, stdenv
, systemd
, udev
, xorg
2020-04-24 23:36:52 +00:00
} :
2024-01-02 11:29:13 +00:00
2020-04-24 23:36:52 +00:00
let
2024-01-02 11:29:13 +00:00
bits = if stdenv . hostPlatform . system == " x 8 6 _ 6 4 - l i n u x " then " x 6 4 " else " i a 3 2 " ;
2020-04-24 23:36:52 +00:00
nwEnv = buildEnv {
name = " n w j s - e n v " ;
paths = [
2024-01-02 11:29:13 +00:00
alsa-lib
at-spi2-core
atk
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libcap
libdrm
2024-05-15 15:35:15 +00:00
libGL
2024-01-02 11:29:13 +00:00
libnotify
2021-12-06 16:07:01 +00:00
libxkbcommon
2024-01-02 11:29:13 +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
2020-04-24 23:36:52 +00:00
# libnw-specific (not chromium dependencies)
2024-01-02 11:29:13 +00:00
ffmpeg
libxcb
2020-04-24 23:36:52 +00:00
# chromium runtime deps (dlopen’ d)
libuuid
2024-01-02 11:29:13 +00:00
sqlite
udev
2020-04-24 23:36:52 +00:00
] ;
extraOutputsToInstall = [ " l i b " " o u t " ] ;
} ;
2024-09-19 14:19:46 +00:00
version = " 0 . 9 0 . 0 " ;
2024-01-02 11:29:13 +00:00
in
stdenv . mkDerivation {
2020-04-24 23:36:52 +00:00
pname = " n w j s " ;
2024-01-02 11:29:13 +00:00
inherit version ;
2020-04-24 23:36:52 +00:00
2024-01-02 11:29:13 +00:00
src =
let flavor = if sdk then " s d k - " else " " ;
in fetchurl {
url = " h t t p s : / / d l . n w j s . i o / v ${ version } / n w j s - ${ flavor } v ${ version } - l i n u x - ${ bits } . t a r . g z " ;
hash = {
2024-09-19 14:19:46 +00:00
" s d k - i a 3 2 " = " s h a 2 5 6 - d E T X t O d J 9 / 1 w Z 4 7 l / j / K 5 m o N 4 m + K N c 7 v u 7 w V G q l 8 N X Q = " ;
" s d k - x 6 4 " = " s h a 2 5 6 - m R I K I r F I d X Q + t L l e d 3 y g J v M C B D K P 0 8 b l 3 I l q T b Q m Y q 0 = " ;
" i a 3 2 " = " s h a 2 5 6 - + n G I Q u W d P f c t P N z D u 7 m k E U O m L x 1 c w c J o V C A k 6 I m N B x Q = " ;
" x 6 4 " = " s h a 2 5 6 - u E b 0 G T O N a R 5 8 n h j G A a n 1 H C O q Q K t Q 2 J D r T a S L + S f R Y 6 E = " ;
2024-01-02 11:29:13 +00:00
} . " ${ flavor + bits } " ;
} ;
nativeBuildInputs = [
autoPatchelfHook
2024-10-04 16:56:33 +00:00
# override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
# Has to use `makeShellWrapper` from `buildPackages` even though `makeShellWrapper` from the inputs is spliced because `propagatedBuildInputs` would pick the wrong one because of a different offset.
( buildPackages . wrapGAppsHook3 . override { makeWrapper = buildPackages . makeShellWrapper ; } )
2024-01-02 11:29:13 +00:00
] ;
buildInputs = [ nwEnv ] ;
appendRunpaths = map ( pkg : ( lib . getLib pkg ) + " / l i b " ) [ nwEnv stdenv . cc . libc stdenv . cc . cc ] ;
2020-04-24 23:36:52 +00:00
2024-01-02 11:29:13 +00:00
preFixup = ''
gappsWrapperArgs + = (
- - add-flags " \' ' ${ NIXOS_OZONE_WL : + \ '' ${ WAYLAND_DISPLAY : + - - ozone-platform-hint = auto - - enable-features = WaylandWindowDecorations } } "
)
'' ;
installPhase = ''
runHook preInstall
2020-04-24 23:36:52 +00:00
mkdir - p $ out/share/nwjs
cp - R * $ out/share/nwjs
find $ out/share/nwjs
2020-09-25 04:45:31 +00:00
ln - s $ { lib . getLib systemd } /lib/libudev.so $ out/share/nwjs/libudev.so.0
2020-04-24 23:36:52 +00:00
mkdir - p $ out/bin
ln - s $ out/share/nwjs/nw $ out/bin
2021-12-06 16:07:01 +00:00
mkdir $ out/lib
ln - s $ out/share/nwjs/lib/libnw.so $ out/lib/libnw.so
2020-04-24 23:36:52 +00:00
2024-01-02 11:29:13 +00:00
runHook postInstall
'' ;
2020-04-24 23:36:52 +00:00
2021-02-05 17:12:51 +00:00
meta = with lib ; {
2024-06-20 14:57:18 +00:00
description = " A p p r u n t i m e b a s e d o n C h r o m i u m a n d n o d e . j s " ;
2020-04-24 23:36:52 +00:00
homepage = " h t t p s : / / n w j s . i o / " ;
2024-01-02 11:29:13 +00:00
platforms = [ " i 6 8 6 - l i n u x " " x 8 6 _ 6 4 - l i n u x " ] ;
sourceProvenance = with sourceTypes ; [ binaryNativeCode ] ;
maintainers = [ maintainers . mikaelfangel ] ;
mainProgram = " n w " ;
2020-04-24 23:36:52 +00:00
license = licenses . bsd3 ;
} ;
}