mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 14:11:21 +00:00
fetchfirefoxaddon: Allow overriding the src and add a test for it
Co-authored-by: Thomas Sean Dominic Kelly <thomassdk@pm.me>
This commit is contained in:
parent
bc4e52b697
commit
cd42b9fff8
@ -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 ];
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ 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;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user