From 4aa90bb98f41ac48cb3a761792d97773f9c5b6d0 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Thu, 31 Jul 2025 18:46:19 +0300 Subject: [PATCH] zen: try to fix it but realize it doesn't work --- lib/system.nix | 2 +- modules/common/zen-browser.nix | 139 ++++++++++++++++++---------- modules/linux/hyprland/hyprland.nix | 2 +- modules/linux/hyprland/waybar.nix | 4 +- rebuild.nu | 5 +- 5 files changed, 94 insertions(+), 58 deletions(-) diff --git a/lib/system.nix b/lib/system.nix index ca63027..111dd72 100644 --- a/lib/system.nix +++ b/lib/system.nix @@ -11,7 +11,7 @@ inputs: self: super: let |> filter (hasAttrByPath path) |> map (getAttrFromPath path); - inputHomeModules = collectInputs [ "homeModules" "default" ]; + inputHomeModules = collectInputs [ "homeModules" "default" ]; inputModulesLinux = collectInputs [ "nixosModules" "default" ]; inputModulesDarwin = collectInputs [ "darwinModules" "default" ]; diff --git a/modules/common/zen-browser.nix b/modules/common/zen-browser.nix index 9af84bc..9987d9c 100644 --- a/modules/common/zen-browser.nix +++ b/modules/common/zen-browser.nix @@ -1,63 +1,100 @@ { lib, ... }: let - inherit (lib) enabled merge; + inherit (lib) enabled; - lockedAs = Value: merge { + lockedAs = Value: attrs: attrs // { inherit Value; Locked = true; }; - locked = merge { Locked = true; }; + locked = attrs: attrs // { Locked = true; }; + + policies = { + AutofillAddressEnabled = false; + AutofillCreditCardEnabled = false; + + DisableAppUpdate = true; + AppAutoUpdate = false; + BackgroundAppUpdate = false; + + DisableFeedbackCommands = true; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableProfileImport = true; + DisableProfileRefresh = true; + + BlockAboutConfig = false; + BlockAboutProfiles = true; + BlockAboutSupport = true; + + # We want it to be the default browser. + DontCheckDefaultBrowser = false; + + NoDefaultBookmarks = true; + + # I accept the terms of use. + SkipTermsOfUse = true; + + PictureInPicture = lockedAs false {}; + + Homepage = locked { StartPage = "previous-session"; }; + + EnableTrackingProtection = lockedAs true { + Cryptomining = true; + EmailTracking = true; + Fingerprinting = true; + }; + + UserMessaging = locked { + ExtensionRecommendations = false; + FeatureRecommendations = false; + FirefoxLabs = false; + MoreFromMozilla = false; + SkipOnboarding = true; + }; + + FirefoxSuggest = locked { + ImproveSuggest = false; + SponsoredSuggestions = false; + WebSuggestions = false; + }; + + SearchEngines = { + Default = "Kagi"; + + PreventInstalls = true; + + Remove = [ + "Google" + "Bing" + "DuckDuckGo" + "Wikipedia (en)" + ]; + + Add = [ + { Name = "Kagi"; Alias = "kk"; Method = "GET"; URLTemplate = "https://kagi.com/search?q={searchTerms}"; SuggestURLTemplate = "https://kagi.com/api/autosuggest?q={searchTerms}"; } + { Name = "Google"; Alias = "gg"; Method = "GET"; URLTemplate = "https://google.com/search?q={searchTerms}"; SuggestURLTemplate = "https://google.com/complete/search?client=firefox&q={searchTerms}"; } + { Name = "Yandex"; Alias = "yy"; Method = "GET"; URLTemplate = "https://yandex.com/search?text={searchTerms}"; SuggestURLTemplate = "https://suggest.yandex.com/suggest-ff.cgi?part={searchTerms}"; } + + { Name = "Wikipedia"; Alias = "ww"; Method = "GET"; URLTemplate = "https://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}"; } + { Name = "YouTube"; Alias = "yt"; Method = "GET"; URLTemplate = "https://youtube.com/results?search_query={searchTerms}"; } + + { Name = "Sourcegraph"; Alias = "sg"; Method = "GET"; URLTemplate = "https://sourcegraph.com/search?q=context:global+{searchTerms}"; } + { Name = "GitHub"; Alias = "gh"; Method = "GET"; URLTemplate = "https://github.com/search?type=repositories&q={searchTerms}"; } + { Name = "Lib.rs"; Alias = "rs"; Method = "GET"; URLTemplate = "https://lib.rs/search?q={searchTerms}"; } + + { Name = "Seachix"; Alias = "sx"; Method = "GET"; URLTemplate = "https://searchix.ovh/?query={searchTerms}"; } + { Name = "NixOS Packages"; Alias = "np"; Method = "GET"; URLTemplate = "https://search.nixos.org/packages?channel=unstable&sort=relevance&type=packages&query={searchTerms}"; } + { Name = "NixOS Options"; Alias = "no"; Method = "GET"; URLTemplate = "https://search.nixos.org/options?channel=unstable&sort=relevance&type=options&query={searchTerms}"; } + { Name = "Home Manager Options"; Alias = "ho"; Method = "GET"; URLTemplate = "https://home-manager-options.extranix.com/?release=master&query={searchTerms}"; } + { Name = "Nix Darwin Options"; Alias = "do"; Method = "GET"; URLTemplate = "https://options.nix-darwin.uz/?release=master&query={searchTerms}"; } + ]; + }; + }; in { home-manager.sharedModules = [{ programs.zen-browser = enabled { - # package = mkIf config.isDarwin null; - - policies = { - AutofillAddressEnabled = false; - AutofillCreditCardEnabled = false; - - DisableAppUpdate = true; - DisableFeedbackCommands = true; - DisableFirefoxStudies = true; - DisablePocket = true; - DisableTelemetry = true; - - # We want Zen to be the default browser. - DontCheckDefaultBrowser = false; - - NoDefaultBookmarks = true; - - # I accept the terms of use. - SkipTermsOfUse = true; - - PictureInPicture = lockedAs false; - - Homepage.StartPage = "previous-session"; - - EnableTrackingProtection = lockedAs true { - Cryptomining = true; - EmailTracking = true; - Fingerprinting = true; - }; - - UserMessaging = locked { - ExtensionRecommendations = false; - FeatureRecommendations = false; - FirefoxLabs = false; - MoreFromMozilla = false; - SkipOnboarding = true; - }; - - FirefoxSuggest = locked { - ImproveSuggest = false; - SponsoredSuggestions = false; - WebSuggestions = false; - }; - }; - - # policies.Preferences = { - - # }; + inherit policies; }; }]; } diff --git a/modules/linux/hyprland/hyprland.nix b/modules/linux/hyprland/hyprland.nix index 49b5cfa..b28d68a 100644 --- a/modules/linux/hyprland/hyprland.nix +++ b/modules/linux/hyprland/hyprland.nix @@ -139,7 +139,7 @@ in merge <| mkIf config.isDesktop { "SUPER+SHIFT, RETURN, exec, kitty" "SUPER , RETURN, exec, ghostty --gtk-single-instance=true" - "SUPER , W , exec, zen-beta" + "SUPER , W , exec, zen" "SUPER , D , exec, discord" "SUPER , Z , exec, zulip" "SUPER , M , exec, thunderbird" diff --git a/modules/linux/hyprland/waybar.nix b/modules/linux/hyprland/waybar.nix index b245e6e..9765ea5 100644 --- a/modules/linux/hyprland/waybar.nix +++ b/modules/linux/hyprland/waybar.nix @@ -35,9 +35,9 @@ in merge <| mkIf config.isDesktop { "hyprland/window" = { separate-outputs = true; - rewrite."(.*) - Discord" = "󰙯 $1"; + rewrite."(.*) - Discord" = "󰙯 $1"; rewrite."(.*) — Zen" = "󰖟 $1"; - rewrite."(.*) — nu" = " $1"; + rewrite."(.*) — nu" = " $1"; }; modules-right = [ "tray" "pulseaudio" "backlight" "cpu" "memory" "network" "battery" "clock" ]; diff --git a/rebuild.nu b/rebuild.nu index 1544bef..612a8b2 100755 --- a/rebuild.nu +++ b/rebuild.nu @@ -55,9 +55,8 @@ def main --wrapped [ ] | append ($args_split | get 0 | where { $in != "" }) let nix_flags = [ - "--option" "accept-flake-config" "true" - # "--option" "eval-cache" "false" - "--option" "extra-experimental-features" "pipe-operators" + "--accept-flake-config" + "--extra-experimental-features" "pipe-operators" ] | append ($args_split | get --ignore-errors 1 | default []) if (uname | get kernel-name) == "Darwin" {