diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2019-06-28 17:54:11 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2019-07-22 18:29:52 +0200 |
commit | 3944aa051ca503e255a9da5cf03a58faf6dec268 (patch) | |
tree | bc3c722cb02b5c5f90c7ca6e31e1b59ed8cca169 /nixos/tests/nextcloud/with-postgresql-and-redis.nix | |
parent | d893a9acf8d8727b2907987c064206dcc89f3fb5 (diff) | |
download | nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar.gz nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar.bz2 nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar.lz nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar.xz nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.tar.zst nixlib-3944aa051ca503e255a9da5cf03a58faf6dec268.zip |
nixos/nextcloud: write config to additional config file
One of the main problems of the Nextcloud module is that it's currently not possible to alter e.g. database configuration after the initial setup as it's written by their imperative installer to a file. After some research[1] it turned out that it's possible to override all values with an additional config file. The documentation has been slightly updated to remain up-to-date, but the warnings should remain there as the imperative configuration is still used and may cause unwanted side-effects. Also simplified the postgresql test which uses `ensure{Databases,Users}` to configure the database. Fixes #49783 [1] https://github.com/NixOS/nixpkgs/issues/49783#issuecomment-483063922
Diffstat (limited to 'nixos/tests/nextcloud/with-postgresql-and-redis.nix')
-rw-r--r-- | nixos/tests/nextcloud/with-postgresql-and-redis.nix | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/nixos/tests/nextcloud/with-postgresql-and-redis.nix b/nixos/tests/nextcloud/with-postgresql-and-redis.nix index 0351d4db69ac..8a840a608753 100644 --- a/nixos/tests/nextcloud/with-postgresql-and-redis.nix +++ b/nixos/tests/nextcloud/with-postgresql-and-redis.nix @@ -27,10 +27,7 @@ in { dbtype = "pgsql"; dbname = "nextcloud"; dbuser = "nextcloud"; - dbhost = "localhost"; - dbpassFile = toString (pkgs.writeText "db-pass-file" '' - hunter2 - ''); + dbhost = "/run/postgresql"; inherit adminuser; adminpassFile = toString (pkgs.writeText "admin-pass-file" '' ${adminpass} @@ -84,10 +81,12 @@ in { services.postgresql = { enable = true; - initialScript = pkgs.writeText "psql-init" '' - create role nextcloud with login password 'hunter2'; - create database nextcloud with owner nextcloud; - ''; + ensureDatabases = [ "nextcloud" ]; + ensureUsers = [ + { name = "nextcloud"; + ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; + } + ]; }; }; }; |