2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
|
|
|
|
# testing
|
|
|
|
, testers
|
|
|
|
, witness
|
|
|
|
}:
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "witness";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "0.4.0";
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "in-toto";
|
|
|
|
repo = "witness";
|
2022-02-20 05:27:41 +00:00
|
|
|
rev = "v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
sha256 = "sha256-QnZZVQZMkh9GH6io19mlE3gHaiX73TgH7ibFT1H5DB4=";
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
2024-06-05 15:53:02 +00:00
|
|
|
vendorHash = "sha256-5q405OP8VPChhxiH2tjh2H+ailQRjGmLZvul7CubjJo=";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
# We only want the witness binary, not the helper utilities for generating docs.
|
2022-06-26 10:26:21 +00:00
|
|
|
subPackages = [ "." ];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2024-01-02 11:29:13 +00:00
|
|
|
"-X github.com/in-toto/witness/cmd.Version=v${version}"
|
2022-03-05 16:20:37 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# Feed in all tests for testing
|
|
|
|
# This is because subPackages above limits what is built to just what we
|
|
|
|
# want but also limits the tests
|
|
|
|
preCheck = ''
|
|
|
|
unset subPackages
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd witness \
|
|
|
|
--bash <($out/bin/witness completion bash) \
|
|
|
|
--fish <($out/bin/witness completion fish) \
|
|
|
|
--zsh <($out/bin/witness completion zsh)
|
|
|
|
'';
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = witness;
|
|
|
|
command = "witness version";
|
|
|
|
version = "v${version}";
|
|
|
|
};
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A pluggable framework for software supply chain security. Witness prevents tampering of build materials and verifies the integrity of the build process from source to target";
|
2022-03-05 16:20:37 +00:00
|
|
|
longDescription = ''
|
|
|
|
Witness prevents tampering of build materials and verifies the integrity
|
|
|
|
of the build process from source to target. It works by wrapping commands
|
|
|
|
executed in a continuous integration process. Its attestation system is
|
|
|
|
pluggable and offers support out of the box for most major CI and
|
|
|
|
infrastructure providers. Verification of Witness metadata and a secure
|
|
|
|
PKI distribution system will mitigate against many software supply chain
|
|
|
|
attack vectors and can be used as a framework for automated governance.
|
|
|
|
'';
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "witness";
|
2022-02-20 05:27:41 +00:00
|
|
|
homepage = "https://github.com/testifysec/witness";
|
2022-03-05 16:20:37 +00:00
|
|
|
changelog = "https://github.com/testifysec/witness/releases/tag/v${version}";
|
2022-02-20 05:27:41 +00:00
|
|
|
license = licenses.asl20;
|
2022-03-05 16:20:37 +00:00
|
|
|
maintainers = with maintainers; [ fkautz jk ];
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
|
|
|
}
|