about summary refs log tree commit diff
diff options
context:
space:
mode:
authortricktron <thibault.gagnaux@bit.admin.ch>2024-01-08 13:44:09 +0100
committerGitHub <noreply@github.com>2024-01-08 13:44:09 +0100
commitafa089e86dbf166f6e47ebecf30ca697cc249571 (patch)
treebae3f807be323b3b830b41ff2fdf58af9978cb50
parent8c56a751cb0b16e5e3c3ac79dbeaf0ca60722e44 (diff)
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 <ryantm-bot@ryantm.com>
-rw-r--r--pkgs/development/tools/manifest-tool/default.nix27
1 files changed, 19 insertions, 8 deletions
diff --git a/pkgs/development/tools/manifest-tool/default.nix b/pkgs/development/tools/manifest-tool/default.nix
index 6282619535b92..bba035d01e7c6 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;