better python handling in nix module
This commit is contained in:
parent
ddbba31fe6
commit
2d2766ac30
|
@ -5,6 +5,7 @@ let
|
|||
format = pkgs.formats.json {};
|
||||
types = lib.types;
|
||||
config_oauth_secret = "${cfg.settings.DATA_FOLDER}/lenticular_oauth_secret.toml";
|
||||
python_env = python.withPackages (ps: with ps; [ lenticular-cloud gevent setuptools ]);
|
||||
in
|
||||
{
|
||||
options = with lib.options; {
|
||||
|
@ -135,13 +136,10 @@ in
|
|||
enable = cfg.enable;
|
||||
|
||||
environment = let
|
||||
python_path = with python.pkgs; makePythonPath [ pkgs.lenticular-cloud gevent setuptools ];
|
||||
config_file = format.generate "lenticular-cloud.json" cfg.settings;
|
||||
in {
|
||||
# CONFIG_FILE = "/etc/lenticular_cloud/production.conf";
|
||||
CONFIG_FILE = "${config_file}:${config_oauth_secret}";
|
||||
PYTHONPATH = "${python_path}";
|
||||
# PYTHONPATH = "${lenticular-pkg.pythonPath}:${lenticular-pkg}/lib/python3.10/site-packages:${python_path}";
|
||||
};
|
||||
preStart = ''
|
||||
if [[ ! -e "${config_oauth_secret}" ]]; then
|
||||
|
@ -156,7 +154,7 @@ in
|
|||
Type = "simple";
|
||||
WorkingDirectory = cfg.settings.DATA_FOLDER;
|
||||
User = cfg.username;
|
||||
ExecStart = ''${python.pkgs.gunicorn}/bin/gunicorn lenticular_cloud.wsgi --name lenticular_cloud \
|
||||
ExecStart = ''${python_env}/bin/gunicorn lenticular_cloud.wsgi --name lenticular_cloud \
|
||||
--workers 2 --log-level=info \
|
||||
--bind=unix:/run/${cfg.username}/web.sock \
|
||||
-k gevent'';
|
||||
|
|
Loading…
Reference in a new issue