Skip to content

Commit

Permalink
pretalx: Flexibly handle mainProgram
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Apr 12, 2024
1 parent 50fe2ab commit 394496f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions modules/pretalx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
optional
escapeShellArgs
generators
getExe
filterAttrs
filterAttrsRecursive
;
Expand All @@ -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.";
Expand Down Expand Up @@ -496,7 +500,7 @@ in {
};
script = ''
${exportPasswordEnv}
${pretalxWrapped}/bin/pretalx ${command}
${getExe pretalxWrapped} ${command}
'';
};
in {
Expand Down Expand Up @@ -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"];
Expand Down
4 changes: 2 additions & 2 deletions tests/pretalx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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")
'';
}

0 comments on commit 394496f

Please sign in to comment.