small updates

This commit is contained in:
zack 2024-09-23 19:22:17 -04:00
parent 4b02bc72f0
commit 17b183ee8e
No known key found for this signature in database
GPG key ID: 5F873416BCF59F35
13 changed files with 161 additions and 163 deletions

View file

@ -3,41 +3,93 @@
lib,
}: let
pname = "zen-browser";
version = "1.0.1-a.2";
version = "1.0.1-a.4";
src = pkgs.fetchurl {
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen-specific.AppImage";
sha256 = "sha256-Pc65S2WjI/CdKIunmMTKYzqGFfm3D9PHsiOEqfQ7r8A=";
};
appimageContents = pkgs.appimageTools.extractType2 {
inherit pname version src;
};
runtimeLibs = with pkgs;
[
libGL
libGLU
libevent
libffi
libjpeg
libpng
libstartup_notification
libvpx
libwebp
stdenv.cc.cc
fontconfig
libxkbcommon
zlib
freetype
gtk3
libxml2
dbus
xcb-util-cursor
alsa-lib
libpulseaudio
pango
atk
cairo
gdk-pixbuf
glib
udev
libva
mesa
libnotify
cups
pciutils
ffmpeg
libglvnd
pipewire
]
++ (with pkgs.xorg; [
libxcb
libX11
libXcursor
libXrandr
libXi
libXext
libXcomposite
libXdamage
libXfixes
libXScrnSaver
]);
in
pkgs.appimageTools.wrapType2 rec {
inherit pname version src;
pkgs.stdenv.mkDerivation {
inherit version pname;
extraInstallCommands = ''
mkdir -p $out/share/applications $out/share/pixmaps
cp ${appimageContents}/zen.desktop $out/share/applications/
cp ${appimageContents}/zen.png $out/share/pixmaps/
src = builtins.fetchTarball {
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-specific.tar.bz2";
sha256 = "sha256:0jjfr1201gfw0cy8q1jbr504994z33sbw8ip86c6xbww8qm60bqh";
};
for n in {16,32,48,64,128}; do
size=$n"x"$n
mkdir -p $out/share/icons/hicolor/$size/apps
file="default"$n".png"
cp ${appimageContents}/browser/chrome/icons/default/$file $out/share/icons/hicolor/$size/apps/zen.png
done
desktopSrc = ./.;
substituteInPlace $out/share/applications/zen.desktop \
--replace-fail "Exec=zen %u" "Exec=$out/bin/${pname} %u"
phases = ["installPhase" "fixupPhase"];
nativeBuildInputs = [pkgs.makeWrapper pkgs.copyDesktopItems pkgs.wrapGAppsHook];
installPhase = ''
mkdir -p $out/bin && cp -r $src/* $out/bin
install -D $desktopSrc/zen.desktop $out/share/applications/zen.desktop
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen.png
'';
meta = with pkgs.lib; {
description = "Zen Browser - Experience tranquillity while browsing the web without people tracking you.";
homepage = "https://github.com/zen-browser/desktop";
license = licenses.mpl20;
maintainers = with maintainers; [zvictor];
platforms = platforms.linux;
};
fixupPhase = ''
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 "${pkgs.lib.makeLibraryPath runtimeLibs}" \
--set MOZ_LEGACY_PROFILES 1 --set MOZ_ALLOW_DOWNGRADE 1 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen-bin
wrapProgram $out/bin/zen-bin --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}" \
--set MOZ_LEGACY_PROFILES 1 --set MOZ_ALLOW_DOWNGRADE 1 --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/glxtest
wrapProgram $out/bin/glxtest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/updater
wrapProgram $out/bin/updater --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/vaapitest
wrapProgram $out/bin/vaapitest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
'';
meta.mainProgram = "zen";
}

View file

@ -1,81 +0,0 @@
ENGINE_DIR=$(pwd)/engine
SRC_DIR=$(pwd)/src
# Create a directory if it doesn't exist
mkdirp() {
mkdir -p "$1"
}
# Append to a file
append_to_file_sync() {
local file="$1"
local text="$2"
echo -e "$text" >>"$file"
}
# Copy or symlink files
copy_manual() {
local name="$1"
local src_path="$SRC_DIR/$name"
local dest_path="$ENGINE_DIR/$name"
echo "Processing file: $name"
# Ensure the parent directory exists
mkdirp "$(dirname "$dest_path")"
# Remove existing non-symlink file
if [ -e "$dest_path" ] && [ ! -L "$dest_path" ]; then
echo "Removing existing file at $dest_path"
rm -f "$dest_path"
fi
if [ "$(uname)" = "Darwin" ] || [ "$(uname)" = "Linux" ]; then
# Create symlink
echo "Creating symlink: $src_path -> $dest_path"
ln -s "$src_path" "$dest_path"
else
# On Windows or other platforms without symlink permissions
echo "Copying file: $src_path -> $dest_path"
cp "$src_path" "$dest_path"
fi
# Add to .gitignore if not already present
if ! grep -q "$name" "$ENGINE_DIR/.gitignore"; then
echo "Adding $name to .gitignore"
append_to_file_sync "$ENGINE_DIR/.gitignore" "\n$name"
fi
}
# Apply folder patches
apply_folder_patches() {
# Get all files from the source directory, excluding .patch files and node_modules
local all_files=($(find "$SRC_DIR" -type f ! -name "*.patch" ! -path "*/node_modules/*"))
for file in "${all_files[@]}"; do
relative_path="${file#$SRC_DIR/}"
copy_manual "$relative_path"
done
}
# Apply internal patches
apply_internal_patches() {
for patch in $(find $PATCHES_DIR -type f -name "*.patch"); do
echo "Applying internal patch: $patch"
git apply --directory "$ENGINE_DIR" "$patch"
done
}
# Apply git patches
apply_git_patches() {
for patch in $(find $SRC_DIR -type f -name "*.patch"); do
echo "Applying git patch: $patch $ENGINE_DIR"
echo "git apply --directory "$ENGINE_DIR" "$patch""
git apply --verbose "$patch"
done
}
cd engine || exit
apply_git_patches
cd .. || exit
apply_folder_patches

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