nixpkgs/pkgs/development/tools/manifest-tool/default.nix
tricktron afa089e86d
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>
2024-01-08 13:44:09 +01:00

63 lines
1.2 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, git
, stdenv
, testers
, manifest-tool
}:
buildGoModule rec {
pname = "manifest-tool";
version = "2.1.5";
modRoot = "v2";
src = fetchFromGitHub {
owner = "estesp";
repo = "manifest-tool";
rev = "v${version}";
hash = "sha256-TCR8A35oETAZszrZFtNZulzCsh9UwGueTyHyYe+JQeI=";
leaveDotGit = true;
postFetch = ''
git -C $out rev-parse HEAD > $out/.git-revision
rm -rf $out/.git
'';
};
vendorHash = null;
nativeBuildInputs = [ git ];
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
] ++ lib.optionals stdenv.hostPlatform.isStatic [
"-linkmode=external"
"-extldflags"
"-static"
];
preConfigure = ''
export ldflags+=" -X main.gitCommit=$(cat .git-revision)"
'';
tags = lib.optionals stdenv.hostPlatform.isStatic [
"cgo"
"netgo"
"osusergo"
"static_build"
];
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 ];
};
}