From 4005a14f8fd1d31fce5afb30b2a93f7bd4146254 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 15 Jul 2025 18:23:14 +0200 Subject: [PATCH] nixos/lasuite-docs: perform migrations after generating secret key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When generating the key inside the module rather than specifying a hard-coded one, you'd get an error like this otherwise Jul 15 16:02:53 nixos systemd[1]: Starting Docs from SuiteNumérique... [...] Jul 15 16:02:54 nixos lasuite-docs-pre-start[19466]: ValueError: Couldn't setup configuration 'impress.settings.Production': Path '/var/lib/lasuite-docs/django_secret_key' does not exist. --- nixos/modules/services/web-apps/lasuite-docs.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/web-apps/lasuite-docs.nix b/nixos/modules/services/web-apps/lasuite-docs.nix index e18fcb15a0e4..343d90a250cf 100644 --- a/nixos/modules/services/web-apps/lasuite-docs.nix +++ b/nixos/modules/services/web-apps/lasuite-docs.nix @@ -362,10 +362,6 @@ in touch .version fi - if [ "${cfg.backendPackage.version}" != "$(cat .version)" ]; then - ${getExe cfg.backendPackage} migrate - echo -n "${cfg.backendPackage.version}" > .version - fi ${optionalString (cfg.secretKeyPath == null) '' if [[ ! -f /var/lib/lasuite-docs/django_secret_key ]]; then ( @@ -374,6 +370,10 @@ in ) fi ''} + if [ "${cfg.backendPackage.version}" != "$(cat .version)" ]; then + ${getExe cfg.backendPackage} migrate + echo -n "${cfg.backendPackage.version}" > .version + fi ''; environment = pythonEnvironment;