Files
nixpkgs/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

76 lines
1.6 KiB
Nix

{
stdenvNoCC,
fetchurl,
unzip,
lib,
}:
{
pname,
versionPrefix ? "",
version,
zipHash,
meta ? { },
passthru ? { },
...
}@args:
let
plat = stdenvNoCC.hostPlatform.system;
in
stdenvNoCC.mkDerivation (
{
inherit pname versionPrefix version;
src =
if lib.isAttrs zipHash then
fetchurl {
name = "${pname}-${versionPrefix}${version}-${plat}.zip";
hash = zipHash.${plat} or (throw "Unsupported system: ${plat}");
url =
"https://grafana.com/api/plugins/${pname}/versions/${versionPrefix}${version}/download"
+ {
x86_64-linux = "?os=linux&arch=amd64";
aarch64-linux = "?os=linux&arch=arm64";
x86_64-darwin = "?os=darwin&arch=amd64";
aarch64-darwin = "?os=darwin&arch=arm64";
}
.${plat} or (throw "Unsupported system: ${plat}");
}
else
fetchurl {
name = "${pname}-${versionPrefix}${version}.zip";
hash = zipHash;
url = "https://grafana.com/api/plugins/${pname}/versions/${versionPrefix}${version}/download";
};
nativeBuildInputs = [ unzip ];
installPhase = ''
cp -R "." "$out"
chmod -R a-w "$out"
chmod u+w "$out"
'';
passthru = {
updateScript = [
./update-grafana-plugin.sh
pname
];
}
// passthru;
meta = {
homepage = "https://grafana.com/grafana/plugins/${pname}";
}
// meta;
}
// (removeAttrs args [
"zipHash"
"pname"
"versionPrefix"
"version"
"sha256"
"meta"
])
)