From 805c8f56e8ebac1527176fc9d551f73c4cd886f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Qui=C3=B1ones?= Date: Fri, 18 Apr 2025 11:11:14 -0500 Subject: [PATCH] feat: allow policies.json management via unwrapped package override (#49) In previous iterations the browser were forced to have disabled updates but this might create an undesirable behavior in tools like 1Password as you can see here: https://github.com/0xc000022070/zen-browser-flake/issues/48 So I'm allowing to override the browser policies. This will only work for unwrapped packages. --- hm-module.nix | 9 +++++---- package.nix | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hm-module.nix b/hm-module.nix index ac28be1..c91f296 100644 --- a/hm-module.nix +++ b/hm-module.nix @@ -3,8 +3,8 @@ self, name, }: { - pkgs, config, + pkgs, lib, ... }: let @@ -38,9 +38,10 @@ in { config = lib.mkIf config.programs.zen-browser.enable { programs.zen-browser = { package = self.packages.${pkgs.stdenv.system}.${name}; - policies = { - DisableAppUpdate = lib.mkDefault true; - DisableTelemetry = lib.mkDefault true; + # This does not work, the package can't build using these policies + policies = lib.mkDefault { + DisableAppUpdate = true; + DisableTelemetry = true; }; }; }; diff --git a/package.nix b/package.nix index 5a99fbd..ae53bbb 100644 --- a/package.nix +++ b/package.nix @@ -2,6 +2,7 @@ name, variant, desktopFile, + policies ? {}, lib, stdenv, config, @@ -37,13 +38,11 @@ aarch64-linux = "linux-aarch64"; }; - policies = - { - DisableAppUpdate = true; - } - // config.firefox.policies or {}; + firefoxPolicies = + (config.firefox.policies or {}) + // policies; - policiesJson = writeText "firefox-policies.json" (builtins.toJSON {inherit policies;}); + policiesJson = writeText "firefox-policies.json" (builtins.toJSON {policies = firefoxPolicies;}); pname = "zen-${name}-bin-unwrapped"; in