2020-12-23 00:06:27 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
2021-02-18 13:00:22 +01:00
|
|
|
, coreutils
|
2020-12-23 00:06:27 +01:00
|
|
|
, pcsclite
|
|
|
|
, PCSC
|
|
|
|
, pkg-config
|
2021-02-18 13:01:26 +01:00
|
|
|
, hsmSupport ? true
|
2020-12-23 00:06:27 +01:00
|
|
|
}:
|
2019-12-12 05:38:15 +01:00
|
|
|
|
2020-12-23 00:06:27 +01:00
|
|
|
buildGoModule rec {
|
2019-12-12 05:38:15 +01:00
|
|
|
pname = "step-ca";
|
2021-05-15 22:00:20 +02:00
|
|
|
version = "0.15.15";
|
2019-12-12 05:38:15 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "smallstep";
|
|
|
|
repo = "certificates";
|
|
|
|
rev = "v${version}";
|
2021-05-15 22:00:20 +02:00
|
|
|
sha256 = "sha256-YYYpMHEis/zoRsdwW70X8zn0FMsW+2vMYdlWxr3qqzY==";
|
2019-12-12 05:38:15 +01:00
|
|
|
};
|
|
|
|
|
2021-05-15 22:00:20 +02:00
|
|
|
vendorSha256 = "sha256-mjj+70/ioqcchB3X5vZPb0Oa7lA/qKh5zEpidT0jrEs=";
|
2020-12-23 00:06:27 +01:00
|
|
|
|
2021-02-18 13:01:26 +01:00
|
|
|
nativeBuildInputs = lib.optionals hsmSupport [ pkg-config ];
|
2020-12-23 00:06:27 +01:00
|
|
|
|
|
|
|
buildInputs =
|
2021-02-18 13:01:26 +01:00
|
|
|
lib.optionals (hsmSupport && stdenv.isLinux) [ pcsclite ]
|
|
|
|
++ lib.optionals (hsmSupport && stdenv.isDarwin) [ PCSC ];
|
2020-12-23 00:06:27 +01:00
|
|
|
|
2021-02-18 13:00:22 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace systemd/step-ca.service --replace "/bin/kill" "${coreutils}/bin/kill"
|
|
|
|
'';
|
|
|
|
|
2021-02-18 13:01:26 +01:00
|
|
|
preBuild = ''
|
|
|
|
${lib.optionalString (!hsmSupport) "export CGO_ENABLED=0"}
|
|
|
|
'';
|
|
|
|
|
2021-02-18 13:00:22 +01:00
|
|
|
postInstall = ''
|
|
|
|
install -Dm444 -t $out/lib/systemd/system systemd/step-ca.service
|
|
|
|
'';
|
|
|
|
|
2020-12-23 00:06:27 +01:00
|
|
|
# Tests fail on darwin with
|
|
|
|
# panic: httptest: failed to listen on a port: listen tcp6 [::1]:0: bind: operation not permitted [recovered]
|
|
|
|
# probably some sandboxing issue
|
|
|
|
doCheck = stdenv.isLinux;
|
2019-12-12 05:38:15 +01: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-03-20 23:14:26 +01:00
|
|
|
maintainers = with maintainers; [ cmcdragonkai mohe2015 ];
|
2019-12-12 05:38:15 +01:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|