uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,82 @@
{ lib, buildGoModule, fetchurl, fetchFromGitHub, nixosTests, tzdata, wire }:
buildGoModule rec {
pname = "grafana";
version = "8.5.3";
excludedPackages = [ "alert_webhook_listener" "clean-swagger" "release_publisher" "slow_proxy" "slow_proxy_mac" "macaron" ];
src = fetchFromGitHub {
rev = "v${version}";
owner = "grafana";
repo = "grafana";
sha256 = "sha256-O0R+FsZC//Kj9FBb7Xg2fKxn60h/4ATJiropltGM9EI";
};
srcStatic = fetchurl {
url = "https://dl.grafana.com/oss/release/grafana-${version}.linux-amd64.tar.gz";
sha256 = "0812lvcdibviy23y61z9ljy1j5d55ziyvf1y69kxmds2hwsj7iwl";
};
vendorSha256 = "sha256-ZL+A6Sz0uHg7ZzYHmA4EU5ZxfRXBLyKglk135iQT600=";
nativeBuildInputs = [ wire ];
preBuild = ''
# Generate DI code that's required to compile the package.
# From https://github.com/grafana/grafana/blob/v8.2.3/Makefile#L33-L35
wire gen -tags oss ./pkg/server
wire gen -tags oss ./pkg/cmd/grafana-cli/runner
# The testcase makes an API call against grafana.com:
#
# [...]
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get latest.json repo from github.com" logger=update.checker error="Get \"https://raw.githubusercontent.com/grafana/grafana/main/latest.json\": dial tcp: lookup raw.githubusercontent.com on [::1]:53: read udp [::1]:36391->[::1]:53: read: connection refused"
# grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get plugins repo from grafana.com" logger=plugin.manager error="Get \"https://grafana.com/api/plugins/versioncheck?slugIn=&grafanaVersion=\": dial tcp: lookup grafana.com on [::1]:53: read udp [::1]:41796->[::1]:53: read: connection refused"
sed -i -e '/Request is not forbidden if from an admin/a t.Skip();' pkg/tests/api/plugins/api_plugins_test.go
# Skip a flaky test (https://github.com/NixOS/nixpkgs/pull/126928#issuecomment-861424128)
sed -i -e '/it should change folder successfully and return correct result/{N;s/$/\nt.Skip();/}'\
pkg/services/libraryelements/libraryelements_patch_test.go
# main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
rm -r scripts/go
'';
ldflags = [
"-s" "-w" "-X main.version=${version}"
];
# Tests start http servers which need to bind to local addresses:
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
__darwinAllowLocalNetworking = true;
# On Darwin, files under /usr/share/zoneinfo exist, but fail to open in sandbox:
# TestValueAsTimezone: date_formats_test.go:33: Invalid has err for input "Europe/Amsterdam": operation not permitted
preCheck = ''
export ZONEINFO=${tzdata}/share/zoneinfo
'';
postInstall = ''
tar -xvf $srcStatic
mkdir -p $out/share/grafana
mv grafana-*/{public,conf,tools} $out/share/grafana/
cp ./conf/defaults.ini $out/share/grafana/conf/
'';
passthru = {
tests = { inherit (nixosTests) grafana; };
updateScript = ./update.sh;
};
meta = with lib; {
description = "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB";
license = licenses.agpl3;
homepage = "https://grafana.com";
maintainers = with maintainers; [ offline fpletz willibutz globin ma27 Frostman ];
platforms = platforms.linux ++ platforms.darwin;
mainProgram = "grafana-server";
};
}

View file

@ -0,0 +1,7 @@
{ newScope, pkgs }:
let
callPackage = newScope (pkgs // plugins);
plugins = import ./plugins.nix { inherit callPackage; };
in
plugins

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "doitintl-bigquery-datasource";
version = "2.0.2";
zipHash = "sha256-GE6DNuQ5WtS/2VmXbQBeRdVKDbLlLirWXW51i0RF6Cc=";
meta = with lib; {
description = "BigQuery DataSource for Grafana";
license = licenses.mit;
maintainers = with maintainers; [ jwygoda ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafadruid-druid-datasource";
version = "1.2.0";
zipHash = "sha256-DPeyV2jZquSQcSE+HzvxArWEefs9bFNPjZwDFp+dIjg=";
meta = with lib; {
description = "Connects Grafana to Druid";
license = licenses.asl20;
maintainers = with maintainers; [ nukaduka ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-clock-panel";
version = "1.1.3";
zipHash = "sha256-80JaMhY/EduSWvFrScfua99DGhT/FJUqY/kl0CafKCs=";
meta = with lib; {
description = "Clock panel for Grafana";
license = licenses.mit;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-piechart-panel";
version = "1.6.2";
zipHash = "sha256-xKyVT092Ffgzl0BewQw5iZ14I/q6CviUR5t9BVM0bf0=";
meta = with lib; {
description = "Pie chart panel for Grafana";
license = licenses.mit;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,28 @@
{ stdenvNoCC, fetchurl, unzip }:
{ pname, version, zipHash, meta ? {}, passthru ? {}, ... }@args:
stdenvNoCC.mkDerivation ({
inherit pname version;
src = fetchurl {
name = "${pname}-${version}.zip";
url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download";
hash = zipHash;
};
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;
} // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ]))

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-polystat-panel";
version = "1.2.6";
zipHash = "sha256-gbMD2o8A2YYZzkpYiXNkv8Oj958RP47fL6DXj1SBYF0=";
meta = with lib; {
description = "Hexagonal multi-stat panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-worldmap-panel";
version = "0.3.3";
zipHash = "sha256-3n1p3SvcBQMmnbnHimLBP7hauVV1IS3SMwttUWTNvb8=";
meta = with lib; {
description = "World Map panel for Grafana";
license = licenses.mit;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
{ callPackage }:
{
inherit callPackage;
grafanaPlugin = callPackage ./grafana-plugin.nix { };
doitintl-bigquery-datasource = callPackage ./doitintl-bigquery-datasource { };
grafadruid-druid-datasource = callPackage ./grafadruid-druid-datasource { };
grafana-clock-panel = callPackage ./grafana-clock-panel { };
grafana-piechart-panel = callPackage ./grafana-piechart-panel { };
grafana-polystat-panel = callPackage ./grafana-polystat-panel { };
grafana-worldmap-panel = callPackage ./grafana-worldmap-panel { };
}

View file

@ -0,0 +1,8 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
set -eu -o pipefail
readonly plugin_name="$1"
readonly latest_version="$(curl "https://grafana.com/api/plugins/${plugin_name}" | jq -r .version)"
update-source-version "grafanaPlugins.${plugin_name}" "$latest_version"

View file

@ -0,0 +1,39 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts jq nix nix-prefetch-scripts moreutils
set -euxo pipefail
FILE="$(nix-instantiate --eval -E 'with import ./. {}; (builtins.unsafeGetAttrPos "version" grafana).file' | tr -d '"')"
replaceHash() {
old="${1?old hash missing}"
new="${2?new hash missing}"
awk -v OLD="$old" -v NEW="$new" '{
if (i=index($0, OLD)) {
$0 = substr($0, 1, i-1) NEW substr($0, i+length(OLD));
}
print $0;
}' "$FILE" | sponge "$FILE"
}
extractVendorHash() {
original="${1?original hash missing}"
result="$(nix-build -A grafana.go-modules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
[ -z "$result" ] && { echo "$original"; } || { echo "$result"; }
}
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion grafana" | tr -d '"')"
latest="$(curl https://api.github.com/repos/grafana/grafana/releases/latest | jq '.tag_name' -r | tr -d 'v')"
targetVersion="${1:-$latest}"
if [ ! "${oldVersion}" = "${targetVersion}" ]; then
update-source-version grafana "${targetVersion#v}"
oldStaticHash="$(nix-instantiate --eval -A grafana.srcStatic.outputHash | tr -d '"')"
newStaticHash="$(nix-prefetch-url "https://dl.grafana.com/oss/release/grafana-${targetVersion#v}.linux-amd64.tar.gz")"
replaceHash "$oldStaticHash" "$newStaticHash"
goHash="$(nix-instantiate --eval -A grafana.vendorSha256 | tr -d '"')"
emptyHash="$(nix-instantiate --eval -A lib.fakeSha256 | tr -d '"')"
replaceHash "$goHash" "$emptyHash"
replaceHash "$emptyHash" "$(extractVendorHash "$goHash")"
nix-build -A grafana
else
echo "grafana is already up-to-date"
fi