nixos/vikunja: adapt for vikunja 0.23.0

This version removes dedicated api and frontend packages.
This commit is contained in:
Leona Maroni 2024-02-18 22:25:50 +01:00
parent 7f9bb7103a
commit 8817f080cc
No known key found for this signature in database
GPG Key ID: D5B08ADFC75E3605
3 changed files with 14 additions and 17 deletions

View File

@ -130,6 +130,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
release notes of [v19](https://github.com/systemd/mkosi/releases/tag/v19) and
[v20](https://github.com/systemd/mkosi/releases/tag/v20) for a list of changes.
- The `services.vikunja` systemd service now uses `vikunja` as dynamic user instead of `vikunja-api`. Database users might need to be changed.
- The `woodpecker-*` packages have been updated to v2 which includes [breaking changes](https://woodpecker-ci.org/docs/next/migrations#200).
- `services.nginx` will no longer advertise HTTP/3 availability automatically. This must now be manually added, preferably to each location block.

View File

@ -11,8 +11,7 @@ let
in {
options.services.vikunja = with lib; {
enable = mkEnableOption (lib.mdDoc "vikunja service");
package-api = mkPackageOption pkgs "vikunja-api" { };
package-frontend = mkPackageOption pkgs "vikunja-frontend" { };
package = mkPackageOption pkgs "vikunja" { };
environmentFiles = mkOption {
type = types.listOf types.path;
default = [ ];
@ -104,18 +103,18 @@ in {
};
};
systemd.services.vikunja-api = {
description = "vikunja-api";
systemd.services.vikunja = {
description = "vikunja";
after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = [ "multi-user.target" ];
path = [ cfg.package-api ];
path = [ cfg.package ];
restartTriggers = [ configFile ];
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "vikunja";
ExecStart = "${cfg.package-api}/bin/vikunja";
ExecStart = "${cfg.package}/bin/vikunja";
Restart = "always";
EnvironmentFile = cfg.environmentFiles;
};
@ -124,10 +123,6 @@ in {
services.nginx.virtualHosts."${cfg.frontendHostname}" = mkIf cfg.setupNginx {
locations = {
"/" = {
root = cfg.package-frontend;
tryFiles = "try_files $uri $uri/ /";
};
"~* ^/(api|dav|\\.well-known)/" = {
proxyPass = "http://localhost:${toString cfg.port}";
extraConfig = ''
client_max_body_size 20M;
@ -139,7 +134,7 @@ in {
environment.etc."vikunja/config.yaml".source = configFile;
environment.systemPackages = [
cfg.package-api # for admin `vikunja` CLI
cfg.package # for admin `vikunja` CLI
];
};
}

View File

@ -20,8 +20,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
enable = true;
database = {
type = "postgres";
user = "vikunja-api";
database = "vikunja-api";
user = "vikunja";
database = "vikunja";
host = "/run/postgresql";
};
frontendScheme = "http";
@ -30,9 +30,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
};
services.postgresql = {
enable = true;
ensureDatabases = [ "vikunja-api" ];
ensureDatabases = [ "vikunja" ];
ensureUsers = [
{ name = "vikunja-api";
{ name = "vikunja";
ensureDBOwnership = true;
}
];
@ -43,7 +43,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
testScript =
''
vikunjaSqlite.wait_for_unit("vikunja-api.service")
vikunjaSqlite.wait_for_unit("vikunja.service")
vikunjaSqlite.wait_for_open_port(3456)
vikunjaSqlite.succeed("curl --fail http://localhost:3456/api/v1/info")
@ -52,7 +52,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
vikunjaSqlite.succeed("curl --fail http://localhost/api/v1/info")
vikunjaSqlite.succeed("curl --fail http://localhost")
vikunjaPostgresql.wait_for_unit("vikunja-api.service")
vikunjaPostgresql.wait_for_unit("vikunja.service")
vikunjaPostgresql.wait_for_open_port(9090)
vikunjaPostgresql.succeed("curl --fail http://localhost:9090/api/v1/info")