commit 3a8b4ec485d06b2ea6591580e4c72a057f50da62 parent 740ac7c4c9bfb4bc45a7bb86d2a86bb5cb7f742a Author: Silas Brack <silasbrack@gmail.com> Date: Tue, 30 Sep 2025 12:01:19 +0200 feat: use systemd StateDirectory Diffstat:
| M | nixos/simple-web-app.nix | | | 14 | +++++++++----- |
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/nixos/simple-web-app.nix b/nixos/simple-web-app.nix @@ -43,10 +43,10 @@ in ''; }; - database_path = mkOption { - type = types.str; - default = "/tmp/test.sqlite3"; - }; + # database_path = mkOption { + # type = types.str; + # default = "/tmp/test.sqlite3"; + # }; }; }; @@ -71,10 +71,14 @@ in Type = "simple"; User = cfg.user; ExecStart = "${cfg.package}/bin/simple-web-app"; + # DynamicUser = true; + StateDirectory = "my-service"; # Ensures /var/lib/simple-web-app/ }; environment = { # PORT = builtins.toString cfg.port; - DATABASE_PATH = cfg.database_path; + UVICORN_LOG_CONFIG = "${cfg.package}/share/logging.json"; + DEBUG = false; + DATABASE_PATH = "/var/lib/simple-web-app/db.sqlite3"; }; };