From b38460ab891d1c836c08deae83915f88decdb95b Mon Sep 17 00:00:00 2001 From: willemml Date: Tue, 11 Apr 2023 00:46:58 -0700 Subject: [PATCH] disable firefox update checking with policies json --- .../profiles/user/willem/programs/firefox.nix | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/home-manager/modules/profiles/user/willem/programs/firefox.nix b/home-manager/modules/profiles/user/willem/programs/firefox.nix index 72954d7..a56e59e 100644 --- a/home-manager/modules/profiles/user/willem/programs/firefox.nix +++ b/home-manager/modules/profiles/user/willem/programs/firefox.nix @@ -5,6 +5,51 @@ }: { programs.firefox = { enable = true; + package = pkgs.stdenv.mkDerivation { + name = "firefox-with-policies"; + src = + if pkgs.stdenv.isDarwin + then pkgs.firefox-mac + else pkgs.firefox; + policiesJson = + /* + json + */ + '' + { + "policies": { + "DisableAppUpdate": true, + "DisableFirefoxAccounts": true, + "DisableFirefoxStudies": true, + "DisableTelemetry": true, + "DisablePocket": true, + "DontCheckDefaultBrowser": true, + "PasswordManagerEnabled": false + } + } + ''; + buildPhase = + /* + sh + */ + '' + # + mkdir -p $out/bin + cp -r $src/Applications $out/Applications + export RESOURCESDIR="$out/Applications/Firefox.app/Contents/Resources" + chmod +w $RESOURCESDIR + mkdir $RESOURCESDIR/distribution + echo $policiesJson > $RESOURCESDIR/distribution/policies.json + chmod -w $RESOURCESDIR + + cat <>$out/bin/firefox + #! ${pkgs.bash}/bin/bash -e + exec "$out/Applications/Firefox.app/Contents/MacOS/Firefox" "$@" + EOF + + chmod +x $out/bin/firefox + ''; + }; profiles.primary = { id = 0; isDefault = true; @@ -45,7 +90,6 @@ }; "Bing".metaData.hidden = true; - "Google".metaData.alias = "@g"; }; }; settings = {