build: don't ship tcp.csv and udp.csv

Fetch them when building. Keep them up-to-date for Nix like NPM/Go
modules.
This commit is contained in:
Vincent Bernat
2024-06-16 10:57:53 +02:00
parent 03e623f2b7
commit 7ec09aa6f3
5 changed files with 16 additions and 11373 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,8 @@
/bin/ /bin/
/test/ /test/
/orchestrator/clickhouse/data/asns.csv /orchestrator/clickhouse/data/asns.csv
/orchestrator/clickhouse/data/tcp.csv
/orchestrator/clickhouse/data/udp.csv
/console/filter/parser.go /console/filter/parser.go
/common/schema/definition_gen.go /common/schema/definition_gen.go
mock_*.go mock_*.go

View File

@@ -25,6 +25,10 @@
cp -r ../data/frontend $out/data cp -r ../data/frontend $out/data
''; '';
}; };
ianaServiceNames = pkgs.fetchurl {
url = "https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv";
hash = builtins.readFile ./nix/ianaServiceNamesHash.txt;
};
backend = pkgs.buildGoModule.override { inherit go; } { backend = pkgs.buildGoModule.override { inherit go; } {
doCheck = false; doCheck = false;
name = "akvorado"; name = "akvorado";
@@ -42,7 +46,8 @@
GOIMPORTS=${pkgs.gotools}/bin/goimports \ GOIMPORTS=${pkgs.gotools}/bin/goimports \
PIGEON=${pkgs.pigeon}/bin/pigeon \ PIGEON=${pkgs.pigeon}/bin/pigeon \
REVIVE=${pkgs.coreutils}/bin/true \ REVIVE=${pkgs.coreutils}/bin/true \
ASNS_URL=${asn2org}/asns.csv ASNS_URL=${asn2org}/asns.csv \
SERVICES_URL=${ianaServiceNames}
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
@@ -71,14 +76,20 @@
| ${pkgs.gnused}/bin/sed -nE "s/\s+got:\s+(sha256-.*)/\1/p") | ${pkgs.gnused}/bin/sed -nE "s/\s+got:\s+(sha256-.*)/\1/p")
[[ -z "$sha256" ]] || echo $sha256 > nix/npmDepsHash.txt [[ -z "$sha256" ]] || echo $sha256 > nix/npmDepsHash.txt
''; '';
update-ianaServiceNamesHash = ''
sha256=$(2>&1 nix build --no-link .#ianaServiceNames \
| ${pkgs.gnused}/bin/sed -nE "s/\s+got:\s+(sha256-.*)/\1/p")
[[ -z "$sha256" ]] || echo $sha256 > nix/ianaServiceNamesHash.txt
'';
update = '' update = ''
${update-vendorHash} ${update-vendorHash}
${update-npmDepsHash} ${update-npmDepsHash}
${update-ianaServiceNamesHash}
''; '';
}; };
packages = { packages = {
inherit backend frontend; inherit backend frontend ianaServiceNames;
default = backend; default = backend;
}; };

View File

@@ -0,0 +1 @@
sha256-qG0QEo+tJFGxoZ4ZJMlNIcWENTXZcwv1JA9+q3jF7Es=

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff