about summary refs log tree commit diff
path: root/nixos/tests/web-apps
diff options
context:
space:
mode:
authorEdgar B <39066502+Guekka@users.noreply.github.com>2023-04-16 11:21:57 +0200
committerEdgar B <39066502+Guekka@users.noreply.github.com>2023-04-16 11:24:00 +0200
commit33a7f368b40cddbd623db0e40c011be499b6c63f (patch)
tree7c8b834818a2ecfd2809eb00b9ed04ec0fe36c41 /nixos/tests/web-apps
parentd713631265fdbf66c88723e8a54cb1c81c0984e8 (diff)
nixos/monica: init
Diffstat (limited to 'nixos/tests/web-apps')
-rw-r--r--nixos/tests/web-apps/monica.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/tests/web-apps/monica.nix b/nixos/tests/web-apps/monica.nix
new file mode 100644
index 0000000000000..29f5cb85bb13a
--- /dev/null
+++ b/nixos/tests/web-apps/monica.nix
@@ -0,0 +1,33 @@
+import ../make-test-python.nix ({pkgs, ...}:
+let
+  cert = pkgs.runCommand "selfSignedCerts" { nativeBuildInputs = [ pkgs.openssl ]; } ''
+    openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost' -days 36500
+    mkdir -p $out
+    cp key.pem cert.pem $out
+  '';
+in
+{
+  name = "monica";
+
+  nodes = {
+    machine = {pkgs, ...}: {
+      services.monica = {
+        enable = true;
+        hostname = "localhost";
+        appKeyFile = "${pkgs.writeText "keyfile" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}";
+        nginx = {
+          forceSSL = true;
+          sslCertificate = "${cert}/cert.pem";
+          sslCertificateKey = "${cert}/key.pem";
+        };
+      };
+    };
+  };
+
+  testScript = ''
+    start_all()
+    machine.wait_for_unit("monica-setup.service")
+    machine.wait_for_open_port(443)
+    machine.succeed("curl -k --fail https://localhost", timeout=10)
+  '';
+})