Merge pull request #140337 from Artturin/overidesrcfetchff

authored by Artturi and committed by GitHub 46c22f89 70088dc2

+24 -10
+12 -9
pkgs/build-support/fetchfirefoxaddon/default.nix
··· 2 2 3 3 { 4 4 name 5 - , url 5 + , url ? null 6 6 , md5 ? "" 7 7 , sha1 ? "" 8 8 , sha256 ? "" 9 9 , sha512 ? "" 10 10 , fixedExtid ? null 11 11 , hash ? "" 12 + , src ? "" 12 13 }: 13 14 14 - stdenv.mkDerivation rec { 15 - 15 + let 16 + extid = if fixedExtid == null then "nixos@${name}" else fixedExtid; 17 + source = if url == null then src else fetchurl { 18 + url = url; 19 + inherit md5 sha1 sha256 sha512 hash; 20 + }; 21 + in 22 + stdenv.mkDerivation { 16 23 inherit name; 17 - extid = if fixedExtid == null then "nixos@${name}" else fixedExtid; 24 + 18 25 passthru = { 19 26 inherit extid; 20 27 }; ··· 26 33 27 34 UUID="${extid}" 28 35 mkdir -p "$out/$UUID" 29 - unzip -q ${src} -d "$out/$UUID" 36 + unzip -q ${source} -d "$out/$UUID" 30 37 NEW_MANIFEST=$(jq '. + {"applications": { "gecko": { "id": "${extid}" }}, "browser_specific_settings":{"gecko":{"id": "${extid}"}}}' "$out/$UUID/manifest.json") 31 38 echo "$NEW_MANIFEST" > "$out/$UUID/manifest.json" 32 39 cd "$out/$UUID" 33 40 zip -r -q -FS "$out/$UUID.xpi" * 34 41 rm -r "$out/$UUID" 35 42 ''; 36 - src = fetchurl { 37 - url = url; 38 - inherit md5 sha1 sha256 sha512 hash; 39 - }; 40 43 nativeBuildInputs = [ coreutils unzip zip jq ]; 41 44 }
+12 -1
pkgs/build-support/fetchfirefoxaddon/tests.nix
··· 1 - { invalidateFetcherByDrvHash, fetchFirefoxAddon, ... }: 1 + { invalidateFetcherByDrvHash, fetchFirefoxAddon, fetchurl, ... }: 2 2 3 3 { 4 4 simple = invalidateFetcherByDrvHash fetchFirefoxAddon { ··· 7 7 url = "https://addons.mozilla.org/firefox/downloads/file/3059971/image_search_options-3.0.12-fx.xpi"; 8 8 sha256 = "sha256-H73YWX/DKxvhEwKpWOo7orAQ7c/rQywpljeyxYxv0Gg="; 9 9 }; 10 + overidden-source = 11 + let 12 + image-search-options = fetchurl { 13 + url = "https://addons.mozilla.org/firefox/downloads/file/3059971/image_search_options-3.0.12-fx.xpi"; 14 + sha256 = "sha256-H73YWX/DKxvhEwKpWOo7orAQ7c/rQywpljeyxYxv0Gg="; 15 + }; 16 + in 17 + invalidateFetcherByDrvHash fetchFirefoxAddon { 18 + name = "image-search-options"; 19 + src = image-search-options; 20 + }; 10 21 }