From 4b1de43d431bf47f643cb63353fe1307d4a62c0d Mon Sep 17 00:00:00 2001 From: tuxcoder Date: Sun, 17 Dec 2023 15:31:19 +0100 Subject: [PATCH] fix nixos modules --- module.nix | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/module.nix b/module.nix index a1a0768..90026d6 100644 --- a/module.nix +++ b/module.nix @@ -16,7 +16,7 @@ in username = mkOption { type = lib.types.str; description = mdDoc "user to run the service"; - example = "lenticular_cloud"; + default = "lenticular_cloud"; }; service_domain = mkOption { type = lib.types.str; @@ -52,7 +52,7 @@ in }; SQLALCHEMY_DATABASE_URI = mkOption { type = types.str; - default = "postgresql://${username}@/${username}?host=/run/postgresql"; + default = "postgresql://${cfg.username}@/${cfg.username}?host=/run/postgresql"; }; HYDRA_ADMIN_URL = mkOption { type = types.str; @@ -75,26 +75,26 @@ in ]; users = { - groups."${username}" = { + groups."${cfg.username}" = { }; - users."${username}" = { + users."${cfg.username}" = { createHome = true; - home = "/var/lib/${username}"; + home = "/var/lib/${cfg.username}"; description = "web server"; extraGroups = [ # "ory-hydra" ]; - group = username; + group = cfg.username; isSystemUser = true; }; }; services.postgresql = { enable = true; - ensureDatabases = [ username ]; + ensureDatabases = [ cfg.username ]; ensureUsers = [ { - name = username; + name = cfg.username; ensureDBOwnership = true; } ]; @@ -116,10 +116,10 @@ in serverName = cfg.service_domain; locations."/" = { recommendedProxySettings = true; - proxyPass = "http://unix:/run/${username}/web.sock"; + proxyPass = "http://unix:/run/${cfg.username}/web.sock"; }; }; - users.users.nginx.extraGroups = [ username ]; + users.users.nginx.extraGroups = [ cfg.username ]; systemd.services.lenticular-cloud = { description = "lenticular account"; @@ -137,7 +137,7 @@ in # PYTHONPATH = "${lenticular-pkg.pythonPath}:${lenticular-pkg}/lib/python3.10/site-packages:${python_path}"; }; preStart = '' - #cat > ${data_folder}/foobar.conf < ${cfg.settings.DATA_FOLDER}/foobar.conf <