diff --git a/packages/ublock-origin.nix b/packages/ublock-origin.nix index 870a1186..c5a45ad8 100644 --- a/packages/ublock-origin.nix +++ b/packages/ublock-origin.nix @@ -2,6 +2,8 @@ lib, stdenvNoCC, fetchurl, + unzip, + zip, }: stdenvNoCC.mkDerivation (finalAttrs: { @@ -15,10 +17,27 @@ stdenvNoCC.mkDerivation (finalAttrs: { dontUnpack = true; + nativeBuildInputs = [ + unzip + zip + ]; + + postPatch = '' + unzip "$src" + + substituteInPlace ./js/vapi-background-ext.js \ + --replace-fail "browser.dns instanceof Object" "false" + + substituteInPlace ./js/background.js \ + --replace-fail "cnameUncloakEnabled: true" "cnameUncloakEnabled: false" + + zip -x env-vars -r ublock-origin.xpi * + ''; + installPhase = '' runHook preInstall - install -Dm644 "$src" "$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/uBlock0@raymondhill.net.xpi" + install -Dm644 ublock-origin.xpi "$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/uBlock0@raymondhill.net.xpi" runHook postInstall '';