From e3374aff8a747472bafe7cfab2116f362f852590 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Mon, 23 Jan 2023 08:52:02 +0100 Subject: [PATCH 1/2] manifest-tool: init at v2.0.6 --- .../tools/manifest-tool/default.nix | 46 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 48 insertions(+) create mode 100644 pkgs/development/tools/manifest-tool/default.nix diff --git a/pkgs/development/tools/manifest-tool/default.nix b/pkgs/development/tools/manifest-tool/default.nix new file mode 100644 index 000000000000..21e7f35ab6db --- /dev/null +++ b/pkgs/development/tools/manifest-tool/default.nix @@ -0,0 +1,46 @@ +{ lib +, buildGoModule +, fetchFromGitHub +, git +, stdenv +, testers +, manifest-tool +}: + +buildGoModule rec { + pname = "manifest-tool"; + version = "2.0.6"; + gitCommit = "2ed9312726765567a84f2acc44a0c8a6e50f4b7a"; + modRoot = "v2"; + + src = fetchFromGitHub { + owner = "estesp"; + repo = "manifest-tool"; + rev = "v${version}"; + sha256 = "sha256-oopk++IdNF6msxOszT0fKxQABgWKbaQZ2aNH9chqWU0="; + leaveDotGit = true; + postFetch = '' + git -C $out rev-parse HEAD > $out/.git-revision + rm -rf $out/.git + ''; + }; + + vendorHash = null; + + nativeBuildInputs = [ git ]; + + preConfigure = '' + ldflags="-X main.gitCommit=$(cat .git-revision)" + ''; + + passthru.tests.version = testers.testVersion { + package = manifest-tool; + }; + + meta = with lib; { + description = "Command line tool to create and query container image manifest list/indexes"; + homepage = "https://github.com/estesp/manifest-tool"; + license = licenses.asl20; + maintainers = with maintainers; [ tricktron ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index afab231cfb9b..1dee9e3c9fcf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8893,6 +8893,8 @@ with pkgs; mani = callPackage ../development/tools/mani { }; + manifest-tool = callPackage ../development/tools/manifest-tool { }; + mask = callPackage ../development/tools/mask { }; mathpix-snipping-tool = callPackage ../tools/misc/mathpix-snipping-tool { }; From 2c5768fe8fbed772548f63165ee58f7bd94dbfce Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Mon, 23 Jan 2023 09:22:25 +0100 Subject: [PATCH 2/2] manifest-tool: add static binary support --- pkgs/development/tools/manifest-tool/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/tools/manifest-tool/default.nix b/pkgs/development/tools/manifest-tool/default.nix index 21e7f35ab6db..6282619535b9 100644 --- a/pkgs/development/tools/manifest-tool/default.nix +++ b/pkgs/development/tools/manifest-tool/default.nix @@ -33,6 +33,11 @@ buildGoModule rec { 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" ]; + passthru.tests.version = testers.testVersion { package = manifest-tool; };