1import ../make-test-python.nix ({pkgs, ...}:
2let
3 cert = pkgs.runCommand "selfSignedCerts" { nativeBuildInputs = [ pkgs.openssl ]; } ''
4 openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost' -days 36500
5 mkdir -p $out
6 cp key.pem cert.pem $out
7 '';
8in
9{
10 name = "monica";
11
12 nodes = {
13 machine = {pkgs, ...}: {
14 services.monica = {
15 enable = true;
16 hostname = "localhost";
17 appKeyFile = "${pkgs.writeText "keyfile" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}";
18 nginx = {
19 forceSSL = true;
20 sslCertificate = "${cert}/cert.pem";
21 sslCertificateKey = "${cert}/key.pem";
22 };
23 };
24 };
25 };
26
27 testScript = ''
28 start_all()
29 machine.wait_for_unit("monica-setup.service")
30 machine.wait_for_open_port(443)
31 machine.succeed("curl -k --fail https://localhost", timeout=10)
32 '';
33})