diff options
author | Luis Hebendanz <luis.nixos@gmail.com> | 2020-11-30 16:30:46 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2020-12-02 09:40:53 +0100 |
commit | 397597f731de70130ee3949a22c99c6236c16c06 (patch) | |
tree | 280cd77df0501d0553679ea4f6457278e5cdb3f2 /pkgs/applications/networking/browsers/firefox/wrapper.nix | |
parent | eedee46f2fff823147d1b9aaa767397737bdea11 (diff) |
Added fetchfirefoxaddon
Diffstat (limited to '')
-rw-r--r-- | pkgs/applications/networking/browsers/firefox/wrapper.nix | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 5f4ce80bd7ac..a95e871b3069 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -35,9 +35,13 @@ let , cfg ? config.${browserName} or {} ## Following options are needed for extra prefs & policies + # For more information about anti tracking (german website) + # vist https://wiki.kairaven.de/open/app/firefo , extraPrefs ? "" + # For more information about policies visit + # https://github.com/mozilla/policy-templates#enterprisepoliciesenabled , extraPolicies ? {} - , firefoxLibName ? "firefox" + , firefoxLibName ? "firefox" # Important for tor package or the like , extraExtensions ? [ ] }: @@ -98,37 +102,10 @@ let (builtins.toJSON enterprisePolicies); extensions = builtins.map (a: - if ! (builtins.hasAttr "name" a) || ! (builtins.isString a.name) then - throw "Firefox addon needs a name attribute" - else if ! (builtins.hasAttr "url" a) || ! (builtins.isString a.url) then - throw "Addon ${a.pname} needs an url" - else if ! (builtins.hasAttr "sha256" a) || ! (builtins.isString a.sha256) then - throw "Addon ${a.pname} needs an sha256 checksum" - else stdenv.mkDerivation rec { - pname = a.name; - version = "1.0"; - src = fetchurl { - url = a.url; - sha256 = a.sha256; - }; - - phases = [ "buildPhase" ]; - - extid = "${a.sha256}@${a.name}"; - - buildInputs = [ zip unzip jq ]; - - buildPhase = '' - UUID="${extid}" - mkdir -p "$out/$UUID" - unzip -q ${src} -d "$out/$UUID" - NEW_MANIFEST=$(jq '. + {"applications": { "gecko": { "id": "${extid}" }}, "browser_specific_settings":{"gecko":{"id": "${extid}"}}}' "$out/$UUID/manifest.json") - echo "$NEW_MANIFEST" > "$out/$UUID/manifest.json" - cd "$out/$UUID" - zip -r -q -FS "$out/$UUID.xpi" * - rm -r "$out/$UUID" - ''; - } + if ! (builtins.hasAttr "extid" a) then + throw "extraExtensions has an invalid entry. Missing extid attribute. Please use fetchfirefoxaddon" + else + a ) extraExtensions; enterprisePolicies = |