From 394496f23bdbe5c21f591e3a0b4646963d3f09f2 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Fri, 12 Apr 2024 16:30:50 +0200 Subject: [PATCH] pretalx: Flexibly handle mainProgram --- modules/pretalx.nix | 14 +++++++++----- tests/pretalx/default.nix | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/pretalx.nix b/modules/pretalx.nix index 98abf2c7..893e0117 100644 --- a/modules/pretalx.nix +++ b/modules/pretalx.nix @@ -27,6 +27,7 @@ optional escapeShellArgs generators + getExe filterAttrs filterAttrsRecursive ; @@ -48,10 +49,13 @@ pretalxWrapped = pkgs.runCommand "pretalx-wrapper" - {nativeBuildInputs = [pkgs.makeWrapper pkgs.python3Packages.wrapPython];} + { + nativeBuildInputs = [pkgs.makeWrapper pkgs.python3Packages.wrapPython]; + meta.mainProgram = cfg.package.meta.mainProgram; + } '' - makeWrapper ${cfg.package}/bin/pretalx \ - $out/bin/pretalx --prefix PYTHONPATH : "${PYTHONPATH}" + makeWrapper ${getExe cfg.package} \ + $out/bin/${cfg.package.meta.mainProgram} --prefix PYTHONPATH : "${PYTHONPATH}" ''; secretRecommendation = "Consider using a secret managing scheme such as `agenix` or `sops-nix` to generate this file."; @@ -496,7 +500,7 @@ in { }; script = '' ${exportPasswordEnv} - ${pretalxWrapped}/bin/pretalx ${command} + ${getExe pretalxWrapped} ${command} ''; }; in { @@ -526,7 +530,7 @@ in { script = '' ${exportPasswordEnv} export DJANGO_SUPERUSER_PASSWORD=$(cat ${cfg.init.admin.passwordFile}) - ${pretalxWrapped}/bin/pretalx init --noinput + ${getExe pretalxWrapped} init --noinput touch ${libDir}/init-will-not-run-again-if-this-file-exists ''; requires = ["pretalx-migrate.service"]; diff --git a/tests/pretalx/default.nix b/tests/pretalx/default.nix index 12ab503d..dc0b1ddb 100644 --- a/tests/pretalx/default.nix +++ b/tests/pretalx/default.nix @@ -64,10 +64,10 @@ in { server.wait_for_unit("pretalx-web.service") server.wait_until_succeeds("curl --fail --connect-timeout 2 localhost", timeout=60) - server.execute("pretalx create_test_event") + server.execute("${nodes.server.services.ngi-pretalx.package.meta.mainProgram} create_test_event") # NOTE: "democon" is the slug of the event created by - # `pretalx create_test_event`. + # `pretalx-manage create_test_event`. server.succeed("curl --fail --connect-timeout 10 http://localhost/democon") ''; }