From 63528355a9b9f492809a777d9ac8d6e529688b02 Mon Sep 17 00:00:00 2001 From: tilpner Date: Mon, 18 May 2020 13:04:08 +0200 Subject: Patch custom qwantjunior addon into omni.ja --- nix/lib.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'nix') diff --git a/nix/lib.nix b/nix/lib.nix index 1095ab4..93b3dc8 100644 --- a/nix/lib.nix +++ b/nix/lib.nix @@ -49,11 +49,20 @@ rec { final = lib.foldl lib.recursiveUpdate {} sanitised; in final; - bundle = { policies ? {}, preferences ? {} }: + patchOmniJa = src: script: pkgs.runCommand "omni.ja" { } '' + ${pkgs.unzip}/bin/unzip -q ${src} + + ${script} + + ${pkgs.zip}/bin/zip -qr9XD $out . + ''; + + bundle = { policies ? {}, preferences ? {}, patchOmniJaCommand ? "" }: let firefox = pkgs.firefox-unwrapped; policies' = mkPolicies policies; preferences' = mkPrefs preferences; + patchedOmniJa = patchOmniJa "${firefox}/lib/firefox/browser/omni.ja" patchOmniJaCommand; patched = pkgs.runCommand "firefox-bundle" { nativeBuildInputs = [ pkgs.nix ]; disallowedReferences = [ firefox ]; @@ -67,6 +76,7 @@ rec { mkdir $out/lib/firefox/distribution cp ${policies'} $out/lib/firefox/distribution/policies.json cp ${preferences'} $out/lib/firefox/defaults/pref/99-custom.js + cp ${patchedOmniJa} $out/lib/firefox/browser/omni.ja ''; wrapped = (pkgs.wrapFirefox patched { browserName = "firefox"; -- cgit v1.2.3