From 4dd78c63a17c6fa816eca53222a7d0d25aa1f4b3 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Thu, 31 Mar 2022 14:26:45 +0100 Subject: [PATCH] starboard: 0.14.1 -> 0.15.3 --- .../networking/cluster/starboard/default.nix | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/cluster/starboard/default.nix b/pkgs/applications/networking/cluster/starboard/default.nix index 30ca2ee1cdee..96c853d21e40 100644 --- a/pkgs/applications/networking/cluster/starboard/default.nix +++ b/pkgs/applications/networking/cluster/starboard/default.nix @@ -2,36 +2,42 @@ buildGoModule rec { pname = "starboard"; - version = "0.14.1"; + version = "0.15.3"; src = fetchFromGitHub { owner = "aquasecurity"; repo = pname; rev = "v${version}"; - sha256 = "sha256-sB7C0IKadgpQ2h6HuH4D6ku/GXnFfFS+fGCW/RBSc10="; + sha256 = "sha256-EBjAB0uSMAyiVr6KxqrT/F+GIkntmOKNPHL1D0RBdG0="; # populate values that require us to use git. By doing this in postFetch we # can delete .git afterwards and maintain better reproducibility of the src. leaveDotGit = true; postFetch = '' cd "$out" - commit="$(git rev-parse HEAD)" - source_date_epoch=$(git log --date=format:'%Y-%m-%dT%H:%M:%SZ' -1 --pretty=%ad) - substituteInPlace "$out/cmd/starboard/main.go" \ - --replace 'commit = "none"' "commit = \"$commit\"" \ - --replace 'date = "unknown"' "date = \"$source_date_epoch\"" + git rev-parse HEAD > $out/COMMIT + # 0000-00-00T00:00:00Z + date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH find "$out" -name .git -print0 | xargs -0 rm -rf ''; }; - vendorSha256 = "sha256-R7tF724y5WNIByE+9nRoNSZDZzfLtPfK/9tSBkARaN0="; + vendorSha256 = "sha256-BxXH+dJyAQRGAq25CljUImxYIT+nCQpmUPUjHOYF0kc="; nativeBuildInputs = [ installShellFiles ]; subPackages = [ "cmd/starboard" ]; ldflags = [ - "-s" "-w" "-X main.version=v${version}" + "-s" + "-w" + "-X main.version=v${version}" ]; + # ldflags based on metadata from git and source + preBuild = '' + ldflags+=" -X main.gitCommit=$(cat COMMIT)" + ldflags+=" -X main.buildDate=$(cat SOURCE_DATE_EPOCH)" + ''; + preCheck = '' # Remove test that requires networking rm pkg/plugin/aqua/client/client_integration_test.go