Merge pull request #289961 from leona-ya/vikunja-0.23.0

vikunja: 0.22.1 -> 0.23.0
This commit is contained in:
Martin Weinelt 2024-03-03 19:15:35 +01:00 committed by GitHub
commit f09b7dc6a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 200 additions and 142 deletions

View file

@ -162,6 +162,10 @@ 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 `services.vikunja.setupNginx` setting has been removed. Users now need to setup the webserver configuration on their own with a proxy pass to the vikunja service.
- 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

@ -9,10 +9,13 @@ let
useMysql = cfg.database.type == "mysql";
usePostgresql = cfg.database.type == "postgres";
in {
imports = [
(mkRemovedOptionModule [ "services" "vikunja" "setupNginx" ] "services.vikunja no longer supports the automatic set up of a nginx virtual host. Set up your own webserver config with a proxy pass to the vikunja service.")
];
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 = [ ];
@ -21,25 +24,10 @@ in {
For example passwords should be set in one of these files.
'';
};
setupNginx = mkOption {
type = types.bool;
default = config.services.nginx.enable;
defaultText = literalExpression "config.services.nginx.enable";
description = lib.mdDoc ''
Whether to setup NGINX.
Further nginx configuration can be done by changing
{option}`services.nginx.virtualHosts.<frontendHostname>`.
This does not enable TLS or ACME by default. To enable this, set the
{option}`services.nginx.virtualHosts.<frontendHostname>.enableACME` to
`true` and if appropriate do the same for
{option}`services.nginx.virtualHosts.<frontendHostname>.forceSSL`.
'';
};
frontendScheme = mkOption {
type = types.enum [ "http" "https" ];
description = lib.mdDoc ''
Whether the site is available via http or https.
This does not configure https or ACME in nginx!
'';
};
frontendHostname = mkOption {
@ -104,42 +92,27 @@ 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;
};
};
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;
'';
};
};
};
environment.etc."vikunja/config.yaml".source = configFile;
environment.systemPackages = [
cfg.package-api # for admin `vikunja` CLI
cfg.package # for admin `vikunja` CLI
];
};
}

View file

@ -13,15 +13,20 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
frontendScheme = "http";
frontendHostname = "localhost";
};
services.nginx.enable = true;
services.nginx = {
enable = true;
virtualHosts."http://localhost" = {
locations."/".proxyPass = "http://localhost:3456";
};
};
};
vikunjaPostgresql = { pkgs, ... }: {
services.vikunja = {
enable = true;
database = {
type = "postgres";
user = "vikunja-api";
database = "vikunja-api";
user = "vikunja";
database = "vikunja";
host = "/run/postgresql";
};
frontendScheme = "http";
@ -30,20 +35,25 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
};
services.postgresql = {
enable = true;
ensureDatabases = [ "vikunja-api" ];
ensureDatabases = [ "vikunja" ];
ensureUsers = [
{ name = "vikunja-api";
{ name = "vikunja";
ensureDBOwnership = true;
}
];
};
services.nginx.enable = true;
services.nginx = {
enable = true;
virtualHosts."http://localhost" = {
locations."/".proxyPass = "http://localhost:9090";
};
};
};
};
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 +62,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")

View file

@ -0,0 +1,166 @@
{ lib, fetchFromGitHub, stdenv, stdenvNoCC, nodePackages, buildGoModule, jq, mage, writeShellScriptBin, nixosTests, buildNpmPackage, moreutils, cacert }:
let
version = "0.23.0";
src = fetchFromGitHub {
owner = "go-vikunja";
repo = "vikunja";
rev = "v${version}";
hash = "sha256-DGdJ/qO86o4LDB2Soio6/zd5S0su6ffrtT+iOn1eQnA=";
};
frontend = stdenv.mkDerivation (finalAttrs: {
pname = "vikunja-frontend";
inherit version src;
postPatch = ''
cd frontend
'';
pnpmDeps = stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs) src version;
nativeBuildInputs = [
jq
nodePackages.pnpm
moreutils
cacert
];
pnpmPatch = builtins.toJSON {
pnpm.supportedArchitectures = {
os = [ "linux" ];
cpu = [ "x64" "arm64" ];
};
};
postPatch = ''
cd frontend
mv package.json package.json.orig
jq --raw-output ". * $pnpmPatch" package.json.orig > package.json
'';
# https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm install --frozen-lockfile --ignore-script
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';
dontBuild = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = {
x86_64-linux = "sha256-ybAkXe2/VhGZhr59ZQOcQ+SI2a204e8uPjyE40xUVwU=";
aarch64-linux = "sha256-2iURs6JtI/b2+CnLwhog1X5hSFFO6OmmgFRuTbMjH+k=";
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
};
nativeBuildInputs = [
nodePackages.pnpm
nodePackages.nodejs
];
doCheck = true;
preBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${finalAttrs.pnpmDeps}
pnpm install --offline --frozen-lockfile --ignore-script
patchShebangs node_modules/{*,.*}
'';
postBuild = ''
pnpm run build
'';
checkPhase = ''
pnpm run test:unit --run
'';
installPhase = ''
cp -r dist/ $out
'';
});
# Injects a `t.Skip()` into a given test since there's apparently no other way to skip tests here.
skipTest = lineOffset: testCase: file:
let
jumpAndAppend = lib.concatStringsSep ";" (lib.replicate (lineOffset - 1) "n" ++ [ "a" ]);
in ''
sed -i -e '/${testCase}/{
${jumpAndAppend} t.Skip();
}' ${file}
'';
in
buildGoModule {
inherit src version;
pname = "vikunja";
nativeBuildInputs =
let
fakeGit = writeShellScriptBin "git" ''
if [[ $@ = "describe --tags --always --abbrev=10" ]]; then
echo "${version}"
else
>&2 echo "Unknown command: $@"
exit 1
fi
'';
in
[ fakeGit mage ];
vendorHash = "sha256-d4AeQEAtPqMDe5a5aKhCe3i3pDXAMZJkJXxfcAFTx7A=";
prePatch = ''
cp -r ${frontend} frontend/dist
'';
postConfigure = ''
# These tests need internet, so we skip them.
${skipTest 1 "TestConvertTrelloToVikunja" "pkg/modules/migration/trello/trello_test.go"}
${skipTest 1 "TestConvertTodoistToVikunja" "pkg/modules/migration/todoist/todoist_test.go"}
'';
buildPhase = ''
runHook preBuild
# Fixes "mkdir /homeless-shelter: permission denied" - "Error: error compiling magefiles" during build
export HOME=$(mktemp -d)
mage build:build
runHook postBuild
'';
checkPhase = ''
mage test:unit
mage test:integration
'';
installPhase = ''
runHook preInstall
install -Dt $out/bin vikunja
runHook postInstall
'';
passthru.tests.vikunja = nixosTests.vikunja;
meta = {
changelog = "https://kolaente.dev/vikunja/api/src/tag/v${version}/CHANGELOG.md";
description = "The Todo-app to organize your life.";
homepage = "https://vikunja.io/";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [ leona ];
mainProgram = "vikunja";
platforms = lib.platforms.linux;
};
}

View file

@ -1,59 +0,0 @@
{ lib, buildGoModule, fetchFromGitHub, mage, writeShellScriptBin, nixosTests }:
buildGoModule rec {
pname = "vikunja-api";
version = "0.22.1";
src = fetchFromGitHub {
owner = "go-vikunja";
repo = "api";
rev = "v${version}";
hash = "sha256-tYhlAF1VuM/Xz4HP7DtI0hGsiNyYxzFiNIEbm8n9DC8=";
};
nativeBuildInputs =
let
fakeGit = writeShellScriptBin "git" ''
if [[ $@ = "describe --tags --always --abbrev=10" ]]; then
echo "${version}"
else
>&2 echo "Unknown command: $@"
exit 1
fi
'';
in
[ fakeGit mage ];
vendorHash = "sha256-OD/7RCCrRdlrsRW7CRT01cDUvNnedNdTZ8YgDFGaE4o=";
# checks need to be disabled because of needed internet for some checks
doCheck = false;
buildPhase = ''
runHook preBuild
# Fixes "mkdir /homeless-shelter: permission denied" - "Error: error compiling magefiles" during build
export HOME=$(mktemp -d)
mage build:build
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dt $out/bin vikunja
runHook postInstall
'';
passthru.tests.vikunja = nixosTests.vikunja;
meta = {
changelog = "https://kolaente.dev/vikunja/api/src/tag/v${version}/CHANGELOG.md";
description = "API of the Vikunja to-do list app";
homepage = "https://vikunja.io/";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [ leona ];
mainProgram = "vikunja";
platforms = lib.platforms.all;
};
}

View file

@ -1,35 +0,0 @@
{ stdenv, lib, fetchurl, unzip, nixosTests, ... }:
stdenv.mkDerivation rec {
pname = "vikunja-frontend";
version = "0.22.1";
src = fetchurl {
url = "https://dl.vikunja.io/frontend/${pname}-${version}.zip";
hash = "sha256-jkFF6sucLZWpWkPcovTdD9MOyJNPRWIBfK9388X5onc=";
};
nativeBuildInputs = [ unzip ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/
cp -r * $out/
runHook postInstall
'';
passthru.tests.vikunja = nixosTests.vikunja;
meta = {
changelog = "https://kolaente.dev/vikunja/frontend/src/tag/v${version}/CHANGELOG.md";
description = "Frontend of the Vikunja to-do list app";
homepage = "https://vikunja.io/";
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [ leona ];
platforms = lib.platforms.all;
};
}

View file

@ -1159,6 +1159,8 @@ mapAliases ({
ventoy-bin = ventoy; # Added 2023-04-12
ventoy-bin-full = ventoy-full; # Added 2023-04-12
ViennaRNA = viennarna; # Added 2023-08-23
vikunja-api = throw "'vikunja-api' has been replaced by 'vikunja'"; # Added 2024-02-19
vikunja-frontend = throw "'vikunja-frontend' has been replaced by 'vikunja'"; # Added 2024-02-19
vimHugeX = vim-full; # Added 2022-12-04
vim_configurable = vim-full; # Added 2022-12-04
virtmanager = throw "'virtmanager' has been renamed to/replaced by 'virt-manager'"; # Converted to throw 2023-09-10

View file

@ -40972,9 +40972,6 @@ with pkgs;
vimb-unwrapped = callPackage ../applications/networking/browsers/vimb { };
vimb = wrapFirefox vimb-unwrapped { };
vikunja-api = callPackage ../servers/web-apps/vikunja/api.nix { };
vikunja-frontend = callPackage ../servers/web-apps/vikunja/frontend.nix { };
vips = callPackage ../tools/graphics/vips {
inherit (darwin.apple_sdk.frameworks) ApplicationServices Foundation;
};