2021-11-17 04:50:18 -08:00
|
|
|
{ pkgs, config, ... }:
|
|
|
|
{
|
2022-04-23 21:53:13 -07:00
|
|
|
#age.secrets.nextcloud-db.file = "/etc/nixos/secrets/nextcloud-db.age";
|
|
|
|
#age.secrets.nextcloud-db.owner = "nextcloud";
|
|
|
|
#age.secrets.nextcloud-admin.file = "/etc/nixos/secrets/nextcloud-admin.age";
|
|
|
|
#age.secrets.nextcloud-admin.owner = "nextcloud";
|
2021-11-17 04:50:18 -08:00
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
hostName = "mossnet.lan";
|
|
|
|
home = "/data/nextcloud";
|
2022-04-26 03:06:44 -07:00
|
|
|
package = pkgs.nextcloud22;
|
2021-11-17 04:50:18 -08:00
|
|
|
|
|
|
|
# Use HTTPS for links
|
|
|
|
https = false;
|
2022-04-26 03:06:44 -07:00
|
|
|
|
2021-11-17 04:50:18 -08:00
|
|
|
# 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";
|
2022-04-23 21:16:17 -07:00
|
|
|
dbpassFile = "/var/nextcloud-db-pass";
|
|
|
|
|
|
|
|
adminpassFile = "/var/nextcloud-admin-pass";
|
2021-11-17 04:50:18 -08:00
|
|
|
adminuser = "admin";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Enable PostgreSQL
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# Ensure the database, user, and permissions always exist
|
|
|
|
ensureDatabases = [ "nextcloud" ];
|
|
|
|
ensureUsers = [
|
2022-04-26 03:06:44 -07:00
|
|
|
{
|
|
|
|
name = "nextcloud";
|
|
|
|
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
|
|
|
}
|
2021-11-17 04:50:18 -08:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Ensure that postgres is running before running the setup
|
|
|
|
systemd.services."nextcloud-setup" = {
|
2022-04-26 03:06:44 -07:00
|
|
|
requires = [ "postgresql.service" ];
|
|
|
|
after = [ "postgresql.service" ];
|
2021-11-17 04:50:18 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
|
|
|
|
#nixpkgs.config.permittedInsecurePackages = [ "nextcloud-19.0.6"];
|
|
|
|
}
|