From afa089e86dbf166f6e47ebecf30ca697cc249571 Mon Sep 17 00:00:00 2001 From: tricktron Date: Mon, 8 Jan 2024 13:44:09 +0100 Subject: [PATCH] manifest-tool: fix static build and update 2.0.6 -> 2.1.5 (#279451) * manifest-tool: 2.0.6 -> 2.1.5 * manifest-tool: fix static build * manifest-tool: remove import from derivation --------- Co-authored-by: R. Ryantm --- .../tools/manifest-tool/default.nix | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/manifest-tool/default.nix b/pkgs/development/tools/manifest-tool/default.nix index 6282619535b9..bba035d01e7c 100644 --- a/pkgs/development/tools/manifest-tool/default.nix +++ b/pkgs/development/tools/manifest-tool/default.nix @@ -9,15 +9,14 @@ buildGoModule rec { pname = "manifest-tool"; - version = "2.0.6"; - gitCommit = "2ed9312726765567a84f2acc44a0c8a6e50f4b7a"; + version = "2.1.5"; modRoot = "v2"; src = fetchFromGitHub { owner = "estesp"; repo = "manifest-tool"; rev = "v${version}"; - sha256 = "sha256-oopk++IdNF6msxOszT0fKxQABgWKbaQZ2aNH9chqWU0="; + hash = "sha256-TCR8A35oETAZszrZFtNZulzCsh9UwGueTyHyYe+JQeI="; leaveDotGit = true; postFetch = '' git -C $out rev-parse HEAD > $out/.git-revision @@ -29,14 +28,26 @@ buildGoModule rec { nativeBuildInputs = [ git ]; + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + ] ++ lib.optionals stdenv.hostPlatform.isStatic [ + "-linkmode=external" + "-extldflags" + "-static" + ]; + preConfigure = '' - ldflags="-X main.gitCommit=$(cat .git-revision)" + export ldflags+=" -X main.gitCommit=$(cat .git-revision)" ''; - CGO_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1"; - GO_EXTLINK_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1"; - ldflags = lib.optionals stdenv.hostPlatform.isStatic [ "-w" "-extldflags" "-static" ]; - tags = lib.optionals stdenv.hostPlatform.isStatic [ "netgo" ]; + tags = lib.optionals stdenv.hostPlatform.isStatic [ + "cgo" + "netgo" + "osusergo" + "static_build" + ]; passthru.tests.version = testers.testVersion { package = manifest-tool;