step-ca: Add option to disable HSM support

This commit is contained in:
Hedtke, Moritz 2021-02-18 13:01:26 +01:00
parent 106b8616f7
commit 2d821cb5c0

View File

@ -6,6 +6,7 @@
, pcsclite , pcsclite
, PCSC , PCSC
, pkg-config , pkg-config
, hsmSupport ? true
}: }:
buildGoModule rec { buildGoModule rec {
@ -21,16 +22,20 @@ buildGoModule rec {
vendorSha256 = "f1NdszqYYx6X1HqwqG26jjfjXq1gDXLOrh64ccKRQ90="; vendorSha256 = "f1NdszqYYx6X1HqwqG26jjfjXq1gDXLOrh64ccKRQ90=";
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = lib.optionals hsmSupport [ pkg-config ];
buildInputs = buildInputs =
lib.optionals (stdenv.isLinux) [ pcsclite ] lib.optionals (hsmSupport && stdenv.isLinux) [ pcsclite ]
++ lib.optionals (stdenv.isDarwin) [ PCSC ]; ++ lib.optionals (hsmSupport && stdenv.isDarwin) [ PCSC ];
postPatch = '' postPatch = ''
substituteInPlace systemd/step-ca.service --replace "/bin/kill" "${coreutils}/bin/kill" substituteInPlace systemd/step-ca.service --replace "/bin/kill" "${coreutils}/bin/kill"
''; '';
preBuild = ''
${lib.optionalString (!hsmSupport) "export CGO_ENABLED=0"}
'';
postInstall = '' postInstall = ''
install -Dm444 -t $out/lib/systemd/system systemd/step-ca.service install -Dm444 -t $out/lib/systemd/system systemd/step-ca.service
''; '';