2021-12-30 13:39:12 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
let
|
2021-06-28 23:13:55 +00:00
|
|
|
generic = { pname, packageToBuild, description }:
|
2021-04-05 15:23:46 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
inherit pname;
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "0.12.2";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sigstore";
|
|
|
|
repo = "rekor";
|
|
|
|
rev = "v${version}";
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-Ew9RHjzmQGZ9Vou436NdBLAj97vfnrLy9EuRKg4sNHY=";
|
2022-04-27 09:35:20 +00:00
|
|
|
# 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"
|
|
|
|
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
|
|
|
|
'';
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
vendorSha256 = "sha256-SwezkvJx50NpwNrv//Ai8yj5ONfC/hmdKbVS754ofW8=";
|
2021-12-30 13:39:12 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
subPackages = [ packageToBuild ];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X sigs.k8s.io/release-utils/version.gitVersion=v${version}"
|
|
|
|
"-X sigs.k8s.io/release-utils/version.gitTreeState=clean"
|
|
|
|
];
|
|
|
|
|
|
|
|
# ldflags based on metadata from git and source
|
|
|
|
preBuild = ''
|
|
|
|
ldflags+=" -X sigs.k8s.io/release-utils/version.gitCommit=$(cat COMMIT)"
|
|
|
|
ldflags+=" -X sigs.k8s.io/release-utils/version.buildDate=$(cat SOURCE_DATE_EPOCH)"
|
|
|
|
'';
|
2021-12-30 13:39:12 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd ${pname} \
|
|
|
|
--bash <($out/bin/${pname} completion bash) \
|
|
|
|
--fish <($out/bin/${pname} completion fish) \
|
|
|
|
--zsh <($out/bin/${pname} completion zsh)
|
|
|
|
'';
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
inherit description;
|
|
|
|
homepage = "https://github.com/sigstore/rekor";
|
|
|
|
changelog = "https://github.com/sigstore/rekor/releases/tag/v${version}";
|
|
|
|
license = licenses.asl20;
|
2021-08-05 21:33:18 +00:00
|
|
|
maintainers = with maintainers; [ lesuisse jk ];
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
rekor-cli = generic {
|
|
|
|
pname = "rekor-cli";
|
2021-06-28 23:13:55 +00:00
|
|
|
packageToBuild = "cmd/rekor-cli";
|
2021-04-05 15:23:46 +00:00
|
|
|
description = "CLI client for Sigstore, the Signature Transparency Log";
|
|
|
|
};
|
|
|
|
rekor-server = generic {
|
|
|
|
pname = "rekor-server";
|
2021-06-28 23:13:55 +00:00
|
|
|
packageToBuild = "cmd/rekor-server";
|
2021-04-05 15:23:46 +00:00
|
|
|
description = "Sigstore server, the Signature Transparency Log";
|
|
|
|
};
|
|
|
|
}
|