feat: zen browser
This commit is contained in:
@@ -96,6 +96,11 @@
|
|||||||
|
|
||||||
homeManagerModules = {
|
homeManagerModules = {
|
||||||
devenv = ./modules/home-manager/devenv.nix;
|
devenv = ./modules/home-manager/devenv.nix;
|
||||||
|
zen-browser = ./modules/home-manager/zen-browser.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
packages = forAllSystems (pkgs: {
|
||||||
|
zen-browser = pkgs.callPackage ./packages/zen-browser {};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
self.homeManagerModules.devenv
|
self.homeManagerModules.devenv
|
||||||
|
self.homeManagerModules.zen-browser
|
||||||
|
|
||||||
./desktop.nix
|
./desktop.nix
|
||||||
./keymaps.nix
|
./keymaps.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
programs.zen-browser.enable = true;
|
||||||
|
|
||||||
# The *state version* indicates which default
|
# The *state version* indicates which default
|
||||||
# settings are in effect and will therefore help avoid breaking
|
# settings are in effect and will therefore help avoid breaking
|
||||||
# program configurations. Switching to a higher state version
|
# program configurations. Switching to a higher state version
|
||||||
|
|||||||
27
modules/home-manager/zen-browser.nix
Normal file
27
modules/home-manager/zen-browser.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.programs.zen-browser;
|
||||||
|
in {
|
||||||
|
# This could be extended when https://github.com/NixOS/nixpkgs/issues/327982 is
|
||||||
|
# fixed.
|
||||||
|
# mkFirefoxModule (https://github.com/nix-community/home-manager/blob/f99c704fe3a4cf8d72b2d568ec80bc38be1a9407/modules/programs/firefox/mkFirefoxModule.nix)
|
||||||
|
# can be used to create a module that handles extensions just like firefox and librewolf
|
||||||
|
# modules.
|
||||||
|
options.programs.zen-browser = with lib; {
|
||||||
|
enable = mkEnableOption "";
|
||||||
|
package = mkOption {
|
||||||
|
type = with types; package;
|
||||||
|
default = self.packages.${pkgs.system}.zen-browser;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
22
packages/zen-browser/COPYRIGHT
Normal file
22
packages/zen-browser/COPYRIGHT
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
The contents of this directory were copied from the repository https://github.com/0xc000022070/zen-browser-flake,
|
||||||
|
licensed under the MIT License. The full license text is provided bellow:
|
||||||
|
|
||||||
|
Copyright (c) 2024 Luis Quiñones <luis@quinones.pro>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
153
packages/zen-browser/default.nix
Normal file
153
packages/zen-browser/default.nix
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
{pkgs ? import <nixpkgs>, ...}: let
|
||||||
|
name = "beta";
|
||||||
|
|
||||||
|
variant =
|
||||||
|
{
|
||||||
|
beta.x86_64-linux = rec {
|
||||||
|
version = "1.7.4b";
|
||||||
|
sha1 = "5259fa7cbd661f137c5a84d34e48882074a1a20e";
|
||||||
|
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-x86_64.tar.bz2";
|
||||||
|
sha256 = "sha256-hiGb2oyAueKa6Xs6BvtEmgPTRlOXvJ5YDseS8kZ1VbQ=";
|
||||||
|
};
|
||||||
|
beta.aarch64-linux = rec {
|
||||||
|
version = "1.7.4b";
|
||||||
|
sha1 = "5259fa7cbd661f137c5a84d34e48882074a1a20e";
|
||||||
|
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-aarch64.tar.bz2";
|
||||||
|
sha256 = "sha256-/fdgw97Ocg7AYGchHhXSWhFOS0bMb5GVAgZDw6/yh3I=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
.${name}
|
||||||
|
.${pkgs.system};
|
||||||
|
|
||||||
|
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
|
||||||
|
speechd
|
||||||
|
]
|
||||||
|
++ (with pkgs.xorg; [
|
||||||
|
libxcb
|
||||||
|
libX11
|
||||||
|
libXcursor
|
||||||
|
libXrandr
|
||||||
|
libXi
|
||||||
|
libXext
|
||||||
|
libXcomposite
|
||||||
|
libXdamage
|
||||||
|
libXfixes
|
||||||
|
libXScrnSaver
|
||||||
|
]);
|
||||||
|
|
||||||
|
policiesJson = pkgs.writeText "firefox-policies.json" (builtins.toJSON {
|
||||||
|
# https://mozilla.github.io/policy-templates/#disableappupdates
|
||||||
|
policies = {
|
||||||
|
DisableAppUpdate = true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
desktopFile =
|
||||||
|
if name == "beta"
|
||||||
|
then "zen.desktop"
|
||||||
|
else "zen_${name}.desktop";
|
||||||
|
in
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
inherit (variant) version;
|
||||||
|
|
||||||
|
pname = "zen-browser";
|
||||||
|
|
||||||
|
src = builtins.fetchTarball {inherit (variant) url sha256;};
|
||||||
|
desktopSrc = ./.;
|
||||||
|
|
||||||
|
phases = ["installPhase" "fixupPhase"];
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [makeWrapper copyDesktopItems wrapGAppsHook];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/{bin,opt/zen,lib/zen-${variant.version}/distribution} && cp -r $src/* $out/opt/zen
|
||||||
|
ln -s $out/opt/zen/zen $out/bin/zen
|
||||||
|
ln -s ${policiesJson} "$out/lib/zen-${variant.version}/distribution/policies.json"
|
||||||
|
ln -s $out/bin/zen $out/bin/zen-${name}
|
||||||
|
|
||||||
|
install -D $desktopSrc/zen-${name}.desktop $out/share/applications/${desktopFile}
|
||||||
|
|
||||||
|
install -D $src/browser/chrome/icons/default/default16.png $out/share/icons/hicolor/16x16/apps/zen-${name}.png
|
||||||
|
install -D $src/browser/chrome/icons/default/default32.png $out/share/icons/hicolor/32x32/apps/zen-${name}.png
|
||||||
|
install -D $src/browser/chrome/icons/default/default48.png $out/share/icons/hicolor/48x48/apps/zen-${name}.png
|
||||||
|
install -D $src/browser/chrome/icons/default/default64.png $out/share/icons/hicolor/64x64/apps/zen-${name}.png
|
||||||
|
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen-${name}.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
fixupPhase = ''
|
||||||
|
chmod 755 $out/bin/zen $out/opt/zen/*
|
||||||
|
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zen/zen
|
||||||
|
wrapProgram $out/opt/zen/zen --set LD_LIBRARY_PATH "${
|
||||||
|
pkgs.lib.makeLibraryPath runtimeLibs
|
||||||
|
}" \
|
||||||
|
--set MOZ_LEGACY_PROFILES 1 --set MOZ_ALLOW_DOWNGRADE 1 --set MOZ_APP_LAUNCHER zen --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
|
||||||
|
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zen/zen-bin
|
||||||
|
wrapProgram $out/opt/zen/zen-bin --set LD_LIBRARY_PATH "${
|
||||||
|
pkgs.lib.makeLibraryPath runtimeLibs
|
||||||
|
}" \
|
||||||
|
--set MOZ_LEGACY_PROFILES 1 --set MOZ_ALLOW_DOWNGRADE 1 --set MOZ_APP_LAUNCHER zen --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
|
||||||
|
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zen/glxtest
|
||||||
|
wrapProgram $out/opt/zen/glxtest --set LD_LIBRARY_PATH "${
|
||||||
|
pkgs.lib.makeLibraryPath runtimeLibs
|
||||||
|
}"
|
||||||
|
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zen/updater
|
||||||
|
wrapProgram $out/opt/zen/updater --set LD_LIBRARY_PATH "${
|
||||||
|
pkgs.lib.makeLibraryPath runtimeLibs
|
||||||
|
}"
|
||||||
|
|
||||||
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zen/vaapitest
|
||||||
|
wrapProgram $out/opt/zen/vaapitest --set LD_LIBRARY_PATH "${
|
||||||
|
pkgs.lib.makeLibraryPath runtimeLibs
|
||||||
|
}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
inherit desktopFile;
|
||||||
|
|
||||||
|
description = "Experience tranquillity while browsing the web without people tracking you!";
|
||||||
|
homepage = "https://zen-browser.app";
|
||||||
|
downloadPage = "https://zen-browser.app/download/";
|
||||||
|
changelog = "https://github.com/zen-browser/desktop/releases";
|
||||||
|
platforms = pkgs.lib.platforms.linux;
|
||||||
|
mainProgram = "zen";
|
||||||
|
};
|
||||||
|
}
|
||||||
25
packages/zen-browser/zen-beta.desktop
Normal file
25
packages/zen-browser/zen-beta.desktop
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=Zen Browser
|
||||||
|
Exec=zen-beta %u
|
||||||
|
Icon=zen-beta
|
||||||
|
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-beta
|
||||||
|
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-beta %u
|
||||||
|
|
||||||
|
[Desktop Action new-private-window]
|
||||||
|
Name=Open a New Private Window
|
||||||
|
Exec=zen-beta --private-window %u
|
||||||
|
|
||||||
|
[Desktop Action profilemanager]
|
||||||
|
Name=Open the Profile Manager
|
||||||
|
Exec=zen-beta --ProfileManager %u
|
||||||
Reference in New Issue
Block a user