5c370c0b2a
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
70 lines
1.8 KiB
Nix
70 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
buildGoModule,
|
|
coreutils,
|
|
pcsclite,
|
|
PCSC,
|
|
pkg-config,
|
|
hsmSupport ? true,
|
|
nixosTests,
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "step-ca";
|
|
version = "0.26.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "smallstep";
|
|
repo = "certificates";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-yej7gzhaUPbcvqbse7Hh7Im38+DUfC9UZkpjpuG8ctk=";
|
|
};
|
|
|
|
vendorHash = "sha256-XlfdIg8YHCeCvc7kZczUxlxUonyZSQATgsxLTMvNDk4=";
|
|
|
|
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" ];
|
|
|
|
passthru.tests.step-ca = nixosTests.step-ca;
|
|
|
|
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/";
|
|
changelog = "https://github.com/smallstep/certificates/releases/tag/v${version}";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [
|
|
cmcdragonkai
|
|
mohe2015
|
|
techknowlogick
|
|
];
|
|
};
|
|
}
|