diff --git a/modules/postgresql.nix b/modules/postgresql.nix index db07d43..f170c43 100644 --- a/modules/postgresql.nix +++ b/modules/postgresql.nix @@ -50,7 +50,7 @@ in }; dbConfig = passwordCfgs: { - services.postgresql.enable = (builtins.length passwordCfgs) > 0; + services.postgresql.enable = lib.mkDefault ((builtins.length passwordCfgs) > 0); services.postgresql.ensureDatabases = map ({ database, ... }: database) passwordCfgs; services.postgresql.ensureUsers = map ({ username, database, ... }: { name = username; diff --git a/test/modules/postgresql.nix b/test/modules/postgresql.nix index 22e9860..522d70c 100644 --- a/test/modules/postgresql.nix +++ b/test/modules/postgresql.nix @@ -36,6 +36,20 @@ in expr = testConfig {}; }; + testPostgresManualOptions = { + expected = { + services.postgresql = { + enable = true; + ensureUsers = []; + ensureDatabases = []; + }; + systemd.services.postgresql.postStart = ""; + }; + expr = testConfig { + services.postgresql.enable = true; + }; + }; + testPostgresOneWithoutPassword = { expected = { services.postgresql = {