Unverified Commit 46c22f89 authored by Artturi's avatar Artturi Committed by GitHub
Browse files

Merge pull request #140337 from Artturin/overidesrcfetchff

parents 70088dc2 cd42b9ff
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -2,19 +2,26 @@

{
  name
, url
, url ? null
, md5 ? ""
, sha1 ? ""
, sha256 ? ""
, sha512 ? ""
, fixedExtid ? null
, hash ? ""
, src ? ""
}:

stdenv.mkDerivation rec {

  inherit name;
let
  extid = if fixedExtid == null then "nixos@${name}" else fixedExtid;
  source = if url == null then src else fetchurl {
    url = url;
    inherit md5 sha1 sha256 sha512 hash;
  };
in
stdenv.mkDerivation {
  inherit name;

  passthru = {
    inherit extid;
  };
@@ -26,16 +33,12 @@ stdenv.mkDerivation rec {

    UUID="${extid}"
    mkdir -p "$out/$UUID"
    unzip -q ${src} -d "$out/$UUID"
    unzip -q ${source} -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"
  '';
  src = fetchurl {
    url = url;
    inherit md5 sha1 sha256 sha512 hash;
  };
  nativeBuildInputs = [ coreutils unzip zip jq  ];
}
+12 −1
Original line number Diff line number Diff line
{ invalidateFetcherByDrvHash, fetchFirefoxAddon, ... }:
{ invalidateFetcherByDrvHash, fetchFirefoxAddon, fetchurl, ... }:

{
  simple = invalidateFetcherByDrvHash fetchFirefoxAddon {
@@ -7,4 +7,15 @@
    url = "https://addons.mozilla.org/firefox/downloads/file/3059971/image_search_options-3.0.12-fx.xpi";
    sha256 = "sha256-H73YWX/DKxvhEwKpWOo7orAQ7c/rQywpljeyxYxv0Gg=";
  };
  overidden-source =
    let
      image-search-options = fetchurl {
        url = "https://addons.mozilla.org/firefox/downloads/file/3059971/image_search_options-3.0.12-fx.xpi";
        sha256 = "sha256-H73YWX/DKxvhEwKpWOo7orAQ7c/rQywpljeyxYxv0Gg=";
      };
    in
    invalidateFetcherByDrvHash fetchFirefoxAddon {
      name = "image-search-options";
      src = image-search-options;
    };
}