56 lines
1.4 KiB
Nix
56 lines
1.4 KiB
Nix
|
{ pkgs, config, ... }:
|
||
|
{
|
||
|
services.nextcloud = {
|
||
|
enable = true;
|
||
|
hostName = "mossnet.lan";
|
||
|
home = "/data/nextcloud";
|
||
|
package = pkgs.nextcloud21;
|
||
|
|
||
|
# Use HTTPS for links
|
||
|
https = false;
|
||
|
|
||
|
# Auto-update Nextcloud Apps
|
||
|
autoUpdateApps.enable = true;
|
||
|
# Set what time makes sense for you
|
||
|
autoUpdateApps.startAt = "05:00:00";
|
||
|
|
||
|
config = {
|
||
|
# Further forces Nextcloud to use HTTPS
|
||
|
# overwriteProtocol = "https";
|
||
|
|
||
|
# Nextcloud PostegreSQL database configuration, recommended over using SQLite
|
||
|
dbtype = "pgsql";
|
||
|
dbuser = "nextcloud";
|
||
|
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
||
|
dbname = "nextcloud";
|
||
|
dbpassFile = "/var/nextcloud-db-pass";
|
||
|
|
||
|
adminpassFile = "/var/nextcloud-admin-pass";
|
||
|
adminuser = "admin";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# Enable PostgreSQL
|
||
|
services.postgresql = {
|
||
|
enable = true;
|
||
|
|
||
|
# Ensure the database, user, and permissions always exist
|
||
|
ensureDatabases = [ "nextcloud" ];
|
||
|
ensureUsers = [
|
||
|
{ name = "nextcloud";
|
||
|
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
||
|
}
|
||
|
];
|
||
|
};
|
||
|
|
||
|
# Ensure that postgres is running before running the setup
|
||
|
systemd.services."nextcloud-setup" = {
|
||
|
requires = ["postgresql.service"];
|
||
|
after = ["postgresql.service"];
|
||
|
};
|
||
|
|
||
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||
|
|
||
|
#nixpkgs.config.permittedInsecurePackages = [ "nextcloud-19.0.6"];
|
||
|
}
|