2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildGoModule,
|
|
|
|
coreutils,
|
|
|
|
pcsclite,
|
|
|
|
PCSC,
|
|
|
|
pkg-config,
|
|
|
|
hsmSupport ? true,
|
|
|
|
nixosTests,
|
2020-12-27 14:24:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-27 14:24:52 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "step-ca";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.27.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "smallstep";
|
|
|
|
repo = "certificates";
|
2023-05-24 13:37:59 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-31 10:19:44 +00:00
|
|
|
hash = "sha256-byVWNab6Q3yryluhMomzLkRNfXQ/68pAq+YGFjbvX1o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
vendorHash = "sha256-gQEGCbVgtKIaUgBkfpVwLXoUg1EUhaQFn9JZvV5Rjhc=";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
ldflags = [
|
|
|
|
"-w"
|
|
|
|
"-X main.Version=${version}"
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = lib.optionals hsmSupport [ pkg-config ];
|
2020-12-27 14:24:52 +00:00
|
|
|
|
|
|
|
buildInputs =
|
2024-09-26 11:04:55 +00:00
|
|
|
lib.optionals (hsmSupport && stdenv.hostPlatform.isLinux) [ pcsclite ]
|
|
|
|
++ lib.optionals (hsmSupport && stdenv.hostPlatform.isDarwin) [ PCSC ];
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
2020-12-27 14:24:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# 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;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# Tests need to run in a reproducible order, otherwise they run unreliably on
|
|
|
|
# (at least) x86_64-linux.
|
|
|
|
checkFlags = [ "-p 1" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.tests.step-ca = nixosTests.step-ca;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Private certificate authority (X.509 & SSH) & ACME server for secure automated certificate management, so you can use TLS everywhere & SSO for SSH";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://smallstep.com/certificates/";
|
2023-05-24 13:37:59 +00:00
|
|
|
changelog = "https://github.com/smallstep/certificates/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
cmcdragonkai
|
|
|
|
techknowlogick
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|