Manage nextcloud in nixos instead of docker

This commit is contained in:
Charlotte Van Petegem 2021-04-05 15:45:31 +02:00
parent 5ff52a0e19
commit 448d3fb359
No known key found for this signature in database
GPG key ID: 019E764B7184435A
4 changed files with 43 additions and 0 deletions

View file

@ -11,6 +11,7 @@
./git.nix
./global-mailer.nix
./minecraft.nix
./nextcloud.nix
./nix.nix
./nginx.nix
./ovh.nix

41
modules/nextcloud.nix Normal file
View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, ...}:
{
options.chvp.nextcloud.enable = lib.mkOption {
default = false;
example = true;
};
config = lib.mkIf config.chvp.nextcloud.enable {
services = {
nextcloud = {
home = "${config.chvp.dataPrefix}/var/lib/nextcloud";
https = true;
hostName = "nextcloud.vanpetegem.me";
enable = true;
autoUpdateApps.enable = true;
package = pkgs.nextcloud21;
config = {
dbuser = "nextcloud";
dbname = "nextcloud";
dbtype = "pgsql";
dbhost = "/run/postgresql";
adminuser = "admin";
adminpassFile = "${config.chvp.dataPrefix}/var/secrets/nextcloud-admin-password";
};
};
nginx.virtualHosts."nextcloud.vanpetegem.me" = {
forceSSL = true;
useACMEHost = "vanpetegem.me";
};
postgresql = {
enable = true;
dataDir = "${config.chvp.dataPrefix}/var/lib/postgresql/${config.services.postgresql.package.psqlSchema}";
ensureDatabases = [ "nextcloud" ];
ensureUsers = [{
name = "nextcloud";
ensurePermissions = { "DATABASE nextcloud" = "ALL PRIVILEGES"; };
}];
};
};
};
}