2020-12-27 14:24:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
2021-04-12 18:23:04 +00:00
|
|
|
, coreutils
|
2020-12-27 14:24:52 +00:00
|
|
|
, pcsclite
|
|
|
|
, PCSC
|
|
|
|
, pkg-config
|
2021-04-12 18:23:04 +00:00
|
|
|
, hsmSupport ? true
|
2021-12-06 16:07:01 +00:00
|
|
|
, 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";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "0.17.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "smallstep";
|
|
|
|
repo = "certificates";
|
|
|
|
rev = "v${version}";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-hZdsxSEfb+DwnVOnnp9cT6diQWkFVPSa/T8YDsGlg3k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
vendorSha256 = "sha256-OcnqMEotc18rX6BYs3oj8+83MRf7iJJNwjjXUQ5xfp4=";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [ "-buildid=" ];
|
2020-12-27 14:24:52 +00:00
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
nativeBuildInputs = lib.optionals hsmSupport [ pkg-config ];
|
2020-12-27 14:24:52 +00:00
|
|
|
|
|
|
|
buildInputs =
|
2021-04-12 18:23:04 +00:00
|
|
|
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
|
|
|
|
'';
|
2020-12-27 14:24:52 +00:00
|
|
|
|
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;
|
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; {
|
|
|
|
description = "A 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/";
|
|
|
|
license = licenses.asl20;
|
2021-04-12 18:23:04 +00:00
|
|
|
maintainers = with maintainers; [ cmcdragonkai mohe2015 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|