summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/bookwyrm.nix7
-rw-r--r--pkgs/bookwyrm.nix6
2 files changed, 9 insertions, 4 deletions
diff --git a/modules/bookwyrm.nix b/modules/bookwyrm.nix
index 9f48ab3..b57636d 100644
--- a/modules/bookwyrm.nix
+++ b/modules/bookwyrm.nix
@@ -2,6 +2,7 @@
let
cfg = config.services.bookwyrm;
+ manage-wrapper = cfg.package.manage cfg.environmentFile;
in
{
options.services.bookwyrm = with lib; {
@@ -125,9 +126,9 @@ in
environment.PYTHONPATH = cfg.package.pythonPath;
preStart = ''
- ${lib.getExe cfg.package.manage} migrate
+ ${lib.getExe manage-wrapper} migrate
# will fail after the first time
- ${lib.getExe cfg.package.manage} initdb || true
+ ${lib.getExe manage-wrapper} initdb || true
'';
};
@@ -178,7 +179,7 @@ in
users.groups.bookwyrm = {};
environment.systemPackages = mkIf cfg.installWrapper [
- cfg.package.manage
+ manage-wrapper
];
warnings = mkIf (cfg.settings ? "SECRET_KEY") [ ''
diff --git a/pkgs/bookwyrm.nix b/pkgs/bookwyrm.nix
index 0c9cb70..7a5daec 100644
--- a/pkgs/bookwyrm.nix
+++ b/pkgs/bookwyrm.nix
@@ -119,7 +119,11 @@ let
pythonPath = python.pkgs.makePythonPath propagatedBuildInputs;
gunicorn = python.pkgs.gunicorn;
celery = python.pkgs.celery;
- manage = writeShellScriptBin "bookwyrm-manage.py" ''
+ manage = environmentFile: writeShellScriptBin "bookwyrm-manage.py" ''
+ set -a
+ ${if environmentFile != null
+ then "source ${environmentFile}"
+ else ""}
export PYTHONPATH=${passthru.pythonPath}
cd ${bookwyrm.outPath}
exec ${bookwyrm.outPath}/manage.py "$@"