nixpkgs/pkgs/tools/security/step-ca/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.9 KiB
Nix
Raw Normal View History

2024-04-27 21:59:06 +01:00
{
lib,
stdenv,
fetchFromGitHub,
buildGoModule,
coreutils,
pcsclite,
PCSC,
pkg-config,
hsmSupport ? true,
nixosTests,
}:
2019-12-12 04:38:15 +00:00
buildGoModule rec {
2019-12-12 04:38:15 +00:00
pname = "step-ca";
2024-07-22 08:23:59 +01:00
version = "0.27.2";
2019-12-12 04:38:15 +00:00
src = fetchFromGitHub {
owner = "smallstep";
repo = "certificates";
2023-05-21 20:06:22 +01:00
rev = "refs/tags/v${version}";
2024-07-28 11:57:28 +01:00
hash = "sha256-byVWNab6Q3yryluhMomzLkRNfXQ/68pAq+YGFjbvX1o=";
2019-12-12 04:38:15 +00:00
};
2024-07-22 08:23:59 +01:00
vendorHash = "sha256-gQEGCbVgtKIaUgBkfpVwLXoUg1EUhaQFn9JZvV5Rjhc=";
ldflags = [
"-w"
"-X main.Version=${version}"
];
2024-04-27 21:59:06 +01:00
nativeBuildInputs = lib.optionals hsmSupport [ pkg-config ];
buildInputs =
lib.optionals (hsmSupport && stdenv.isLinux) [ pcsclite ]
++ lib.optionals (hsmSupport && stdenv.isDarwin) [ PCSC ];
postPatch = ''
substituteInPlace systemd/step-ca.service --replace "/bin/kill" "${coreutils}/bin/kill"
'';
preBuild = ''
${lib.optionalString (!hsmSupport) "export CGO_ENABLED=0"}
'';
postInstall = ''
install -Dm444 -t $out/lib/systemd/system systemd/step-ca.service
'';
preCheck = ''
export HOME=$(mktemp -d)
'';
# Tests start http servers which need to bind to local addresses:
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted
__darwinAllowLocalNetworking = true;
# Tests need to run in a reproducible order, otherwise they run unreliably on
# (at least) x86_64-linux.
checkFlags = [ "-p 1" ];
2019-12-12 04:38:15 +00:00
2021-11-12 20:37:11 +00:00
passthru.tests.step-ca = nixosTests.step-ca;
2019-12-12 04:38:15 +00:00
meta = with lib; {
description = "Private certificate authority (X.509 & SSH) & ACME server for secure automated certificate management, so you can use TLS everywhere & SSO for SSH";
homepage = "https://smallstep.com/certificates/";
2023-05-21 20:06:22 +01:00
changelog = "https://github.com/smallstep/certificates/releases/tag/v${version}";
2019-12-12 04:38:15 +00:00
license = licenses.asl20;
2024-04-27 21:59:06 +01:00
maintainers = with maintainers; [
cmcdragonkai
techknowlogick
];
2019-12-12 04:38:15 +00:00
};
}