nixos/tests/stunnel: ensure correct ordering w.r.t. shutdown.target

Also, mark the service as `oneshot` since it is.
This commit is contained in:
Philip Taron 2023-11-30 15:47:09 -08:00
parent d8c9b26a16
commit 88dc5ded81
No known key found for this signature in database

View file

@ -19,8 +19,10 @@ let
makeCert = { config, pkgs, ... }: {
systemd.services.create-test-cert = {
wantedBy = [ "sysinit.target" ];
before = [ "sysinit.target" ];
before = [ "sysinit.target" "shutdown.target" ];
conflicts = [ "shutdown.target" ];
unitConfig.DefaultDependencies = false;
serviceConfig.Type = "oneshot";
script = ''
${pkgs.openssl}/bin/openssl req -batch -x509 -newkey rsa -nodes -out /test-cert.pem -keyout /test-key.pem -subj /CN=${config.networking.hostName}
( umask 077; cat /test-key.pem /test-cert.pem > /test-key-and-cert.pem )