1 import ./make-test-python.nix ({ pkgs, lib, ... }:
5 meta = with lib.maintainers; {
6 maintainers = [ willibutz ];
10 hedgedocSqlite = { ... }: {
11 services.hedgedoc.enable = true;
14 hedgedocPostgresWithTCPSocket = { ... }: {
15 systemd.services.hedgedoc.after = [ "postgresql.service" ];
22 password = "$DB_PASSWORD";
25 database = "hedgedocdb";
29 * Do not use pkgs.writeText for secrets as
30 * they will end up in the world-readable Nix store.
32 environmentFile = pkgs.writeText "hedgedoc-env" ''
33 DB_PASSWORD=snakeoilpassword
38 initialScript = pkgs.writeText "pg-init-script.sql" ''
39 CREATE ROLE hedgedoc LOGIN PASSWORD 'snakeoilpassword';
40 CREATE DATABASE hedgedocdb OWNER hedgedoc;
46 hedgedocPostgresWithUNIXSocket = { ... }: {
47 systemd.services.hedgedoc.after = [ "postgresql.service" ];
54 password = "$DB_PASSWORD";
55 host = "/run/postgresql";
56 database = "hedgedocdb";
59 environmentFile = pkgs.writeText "hedgedoc-env" ''
60 DB_PASSWORD=snakeoilpassword
65 initialScript = pkgs.writeText "pg-init-script.sql" ''
66 CREATE ROLE hedgedoc LOGIN PASSWORD 'snakeoilpassword';
67 CREATE DATABASE hedgedocdb OWNER hedgedoc;
77 with subtest("HedgeDoc sqlite"):
78 hedgedocSqlite.wait_for_unit("hedgedoc.service")
79 hedgedocSqlite.wait_for_open_port(3000)
80 hedgedocSqlite.wait_until_succeeds("curl -sSf http://localhost:3000/new")
82 with subtest("HedgeDoc postgres with TCP socket"):
83 hedgedocPostgresWithTCPSocket.wait_for_unit("postgresql.service")
84 hedgedocPostgresWithTCPSocket.wait_for_unit("hedgedoc.service")
85 hedgedocPostgresWithTCPSocket.wait_for_open_port(5432)
86 hedgedocPostgresWithTCPSocket.wait_for_open_port(3000)
87 hedgedocPostgresWithTCPSocket.wait_until_succeeds("curl -sSf http://localhost:3000/new")
89 with subtest("HedgeDoc postgres with UNIX socket"):
90 hedgedocPostgresWithUNIXSocket.wait_for_unit("postgresql.service")
91 hedgedocPostgresWithUNIXSocket.wait_for_unit("hedgedoc.service")
92 hedgedocPostgresWithUNIXSocket.wait_for_open_port(5432)
93 hedgedocPostgresWithUNIXSocket.wait_for_open_port(3000)
94 hedgedocPostgresWithUNIXSocket.wait_until_succeeds("curl -sSf http://localhost:3000/new")