lol

Merge pull request #105796 from Luis-Hebendanz/fix_firefox_wrapper

Fix firefox wrapper

authored by

Jörg Thalheim and committed by
GitHub
29566ca0 3a2fe56a

+18 -7
+10 -1
doc/builders/packages/firefox.section.md
··· 7 7 ```nix 8 8 { 9 9 myFirefox = wrapFirefox firefox-unwrapped { 10 - extraExtensions = [ 10 + nixExtensions = [ 11 11 (fetchFirefoxAddon { 12 12 name = "ublock"; 13 13 url = "https://addons.mozilla.org/firefox/downloads/file/3679754/ublock_origin-1.31.0-an+fx.xpi"; ··· 38 38 }; 39 39 } 40 40 ``` 41 + 42 + If `nixExtensions != null` then all manually installed addons will be uninstalled from your browser profile. 43 + To view available enterprise policies visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled) 44 + or type into the Firefox url bar: `about:policies#documentation`. 45 + Nix installed addons do not have a valid signature, which is why signature verification is disabled. This does not compromise security because downloaded addons are checksumed and manual addons can't be installed. 46 + 47 + # Troubleshooting 48 + If addons do not appear installed although they have been defined in your nix configuration file reset the local addon state of your Firefox profile by clicking `help -> restart with addons disabled -> restart -> refresh firefox`. This can happen if you switch from manual addon mode to nix addon mode and then back to manual mode and then again to nix addon mode. 49 +
+8 -6
pkgs/applications/networking/browsers/firefox/wrapper.nix
··· 41 41 # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled 42 42 , extraPolicies ? {} 43 43 , firefoxLibName ? "firefox" # Important for tor package or the like 44 - , extraExtensions ? [ ] 44 + , nixExtensions ? null 45 45 }: 46 46 47 47 assert forceWayland -> (browser ? gtk3); # Can only use the wayland backend if gtk3 is being used ··· 100 100 policiesJson = builtins.toFile "policies.json" 101 101 (builtins.toJSON enterprisePolicies); 102 102 103 + usesNixExtensions = nixExtensions != null; 104 + 103 105 extensions = builtins.map (a: 104 106 if ! (builtins.hasAttr "extid" a) then 105 - throw "extraExtensions has an invalid entry. Missing extid attribute. Please use fetchfirefoxaddon" 107 + throw "nixExtensions has an invalid entry. Missing extid attribute. Please use fetchfirefoxaddon" 106 108 else 107 109 a 108 - ) extraExtensions; 110 + ) (if usesNixExtensions then nixExtensions else []); 109 111 110 112 enterprisePolicies = 111 113 { 112 - policies = { 114 + policies = lib.optionalAttrs usesNixExtensions { 113 115 DisableAppUpdate = true; 114 116 } // 115 - { 117 + lib.optionalAttrs usesNixExtensions { 116 118 ExtensionSettings = { 117 119 "*" = { 118 120 blocked_install_message = "You can't have manual extension mixed with nix extensions"; ··· 137 139 // to be able to install addons that do not have an extid 138 140 // Security is maintained because only user whitelisted addons 139 141 // with a checksum can be installed 140 - lockPref("xpinstall.signatures.required", false); 142 + ${ lib.optionalString usesNixExtensions ''lockPref("xpinstall.signatures.required", false)'' }; 141 143 ${extraPrefs} 142 144 ''; 143 145