at master 2.2 kB view raw
1{ pkgs, lib, ... }: 2{ 3 name = "vikunja"; 4 5 meta.maintainers = with lib.maintainers; [ leona ]; 6 7 nodes = { 8 vikunjaSqlite = 9 { ... }: 10 { 11 services.vikunja = { 12 enable = true; 13 database = { 14 type = "sqlite"; 15 }; 16 frontendScheme = "http"; 17 frontendHostname = "localhost"; 18 }; 19 services.nginx = { 20 enable = true; 21 virtualHosts."http://localhost" = { 22 locations."/".proxyPass = "http://localhost:3456"; 23 }; 24 }; 25 }; 26 vikunjaPostgresql = 27 { pkgs, ... }: 28 { 29 services.vikunja = { 30 enable = true; 31 database = { 32 type = "postgres"; 33 user = "vikunja"; 34 database = "vikunja"; 35 host = "/run/postgresql"; 36 }; 37 frontendScheme = "http"; 38 frontendHostname = "localhost"; 39 port = 9090; 40 }; 41 services.postgresql = { 42 enable = true; 43 ensureDatabases = [ "vikunja" ]; 44 ensureUsers = [ 45 { 46 name = "vikunja"; 47 ensureDBOwnership = true; 48 } 49 ]; 50 }; 51 services.nginx = { 52 enable = true; 53 virtualHosts."http://localhost" = { 54 locations."/".proxyPass = "http://localhost:9090"; 55 }; 56 }; 57 }; 58 }; 59 60 testScript = '' 61 vikunjaSqlite.wait_for_unit("vikunja.service") 62 vikunjaSqlite.wait_for_open_port(3456) 63 vikunjaSqlite.succeed("curl --fail http://localhost:3456/api/v1/info") 64 65 vikunjaSqlite.wait_for_unit("nginx.service") 66 vikunjaSqlite.wait_for_open_port(80) 67 vikunjaSqlite.succeed("curl --fail http://localhost/api/v1/info") 68 vikunjaSqlite.succeed("curl --fail http://localhost") 69 70 vikunjaPostgresql.wait_for_unit("vikunja.service") 71 vikunjaPostgresql.wait_for_open_port(9090) 72 vikunjaPostgresql.succeed("curl --fail http://localhost:9090/api/v1/info") 73 74 vikunjaPostgresql.wait_for_unit("nginx.service") 75 vikunjaPostgresql.wait_for_open_port(80) 76 vikunjaPostgresql.succeed("curl --fail http://localhost/api/v1/info") 77 vikunjaPostgresql.succeed("curl --fail http://localhost") 78 ''; 79}