pkgs: zenBrowser

This commit is contained in:
Zynh Ludwig 2024-08-22 05:08:10 -07:00
parent f387d5a002
commit feeadee1ea
3 changed files with 115 additions and 0 deletions

View file

@ -8,4 +8,5 @@ in
wrapWine = callDefaultPackage ./wrapWine;
writeXrandrScriptBin = callDefaultPackage ./writeXrandrScriptBin;
borderlessBrowser = callDefaultPackage ./borderlessBrowser;
zenBrowser = callDefaultPackage ./zenBrowser;
}

View file

@ -0,0 +1,89 @@
# Adapted from: https://github.com/MarceColl/zen-browser-flake
{ lib
, stdenv
, makeWrapper
, copyDesktopItems
, libGL
, fontconfig
, libxkbcommon
, zlib
, freetype
, gtk3
, libxml2
, dbus
, xcb-util-cursor
, alsa-lib
, pango
, atk
, cairo
, gdk-pixbuf
, glib
, xorg
}:
stdenv.mkDerivation rec {
name = "zenBrowser";
version = "1.0.0-a.27";
src = builtins.fetchTarball {
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-specific.tar.bz2";
sha256 = "sha256:0vmn10qpr96b4i8j24sa6ipg3fcxiiigkjwclbr5fknkfj3r6ds7";
};
desktopSrc = ./.;
phases = [ "installPhase" "fixupPhase" ];
nativeBuildInputs = [ makeWrapper copyDesktopItems ];
installPhase = ''
mkdir -p $out/bin && cp -r $src/* $out/bin
install -D $desktopSrc/zen.desktop $out/share/applications/dev.zen.Zen.desktop
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen.png
'';
fixupPhase =
let
runtimeLibs = [
libGL
stdenv.cc.cc
fontconfig
libxkbcommon
zlib
freetype
gtk3
libxml2
dbus
xcb-util-cursor
alsa-lib
pango
atk
cairo
gdk-pixbuf
glib
] ++ (with xorg; [
libxcb
libX11
libXcursor
libXrandr
libXi
libXext
libXcomposite
libXdamage
libXfixes
]);
in
''
chmod 755 $out/bin/*
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen
wrapProgram $out/bin/zen --set LD_LIBRARY_PATH "${lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen-bin
wrapProgram $out/bin/zen-bin --set LD_LIBRARY_PATH "${lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/glxtest
wrapProgram $out/bin/glxtest --set LD_LIBRARY_PATH "${lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/updater
wrapProgram $out/bin/updater --set LD_LIBRARY_PATH "${lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/vaapitest
wrapProgram $out/bin/vaapitest --set LD_LIBRARY_PATH "${lib.makeLibraryPath runtimeLibs}"
'';
}

View file

@ -0,0 +1,25 @@
[Desktop Entry]
Name=Zen Browser
Exec=zen %u
Icon=zen
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=zen-alpha
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
X-MultipleArgs=false
Keywords=Internet;WWW;Browser;Web;Explorer;
Actions=new-window;new-private-window;profilemanager;
[Desktop Action new-window]
Name=Open a New Window
Exec=zen %u
[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=zen --private-window %u
[Desktop Action profilemanager]
Name=Open the Profile Manager
Exec=zen --ProfileManager %u