From ad9e817cc22e01223187019b94ab61bcd7fdd9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Thu, 9 Oct 2025 00:47:09 +0200 Subject: [PATCH] nixos/pretalx: run pretalx-manage migrate on plugin changes and upgrades Some plugins like https://github.com/pretalx/pretalx-media-ccc-de require database migrations to properly work. --- nixos/modules/services/web-apps/pretalx.nix | 23 ++++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/web-apps/pretalx.nix b/nixos/modules/services/web-apps/pretalx.nix index 652bccf287f3..f7eaf8d788a9 100644 --- a/nixos/modules/services/web-apps/pretalx.nix +++ b/nixos/modules/services/web-apps/pretalx.nix @@ -439,16 +439,23 @@ in "mysql.service" ]; wantedBy = [ "multi-user.target" ]; - preStart = '' - versionFile="${cfg.settings.filesystem.data}/.version" - version=$(cat "$versionFile" 2>/dev/null || echo 0) + preStart = + let + versionString = lib.concatStringsSep "\n" ( + [ "pretalx-${cfg.package.version}" ] + ++ map (plugin: "${plugin.pname}-${plugin.version}") cfg.plugins + ); + in + '' + versionFile="${cfg.settings.filesystem.data}/.version" + version="$(cat "$versionFile" 2>/dev/null || echo 0)" - if [[ $version != ${cfg.package.version} ]]; then - ${lib.getExe' pythonEnv "pretalx-manage"} migrate + if [[ "$version" != "${versionString}" ]]; then + ${lib.getExe' pythonEnv "pretalx-manage"} migrate - echo "${cfg.package.version}" > "$versionFile" - fi - ''; + echo "${versionString}" > "$versionFile" + fi + ''; serviceConfig = { ExecStart = "${lib.getExe' pythonEnv "gunicorn"} --bind unix:/run/pretalx/pretalx.sock ${cfg.gunicorn.extraArgs} pretalx.wsgi"; RuntimeDirectory = "pretalx";