nixos/nextcloud.nix
agent a3c730e1db Move all services from srazka.com to reudy.net
Renames every domain in the config: Caddy virtual hosts (auth, hello,
nextcloud, git, panel), the ACME contact email, Authelia's session cookie
domain / portal URL / default redirect and TOTP issuer, Nextcloud's
hostName and overwritehost, and Forgejo's DOMAIN (ROOT_URL and ssh clone
URLs follow from it; the panel picks them up via panel.nix). Panel docs and
examples updated too, and a README paragraph that had run together is
split again.

Requires DNS for auth/hello/nextcloud/git/panel.reudy.net (or a
*.reudy.net wildcard) pointing at the server before deploying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UbWSNkXxZhYf7eqHTyx3Bf
2026-09-27 15:32:49 +00:00

53 lines
1.5 KiB
Nix

{ config, pkgs, ... }:
{
# Admin password is managed by agenix.
# Create secrets/nextcloud-admin-pass.age and add it to secrets.nix,
# then run: agenix -e secrets/nextcloud-admin-pass.age
age.secrets."nextcloud-admin-pass" = {
file = ./secrets/nextcloud-admin-pass.age;
owner = "nextcloud";
group = "nextcloud";
mode = "0400";
};
services.nextcloud = {
enable = true;
package = pkgs.nextcloud33;
hostName = "nextcloud.reudy.net";
https = true;
config = {
adminuser = "admin-reudy";
adminpassFile = config.age.secrets."nextcloud-admin-pass".path;
dbtype = "sqlite";
};
# Tell Nextcloud it's behind a trusted reverse proxy.
settings = {
trusted_proxies = [ "127.0.0.1" ];
overwriteprotocol = "https";
overwritehost = "nextcloud.reudy.net";
default_phone_region = "NL";
};
};
# Let Caddy handle TLS termination; nginx only listens on localhost.
# The nextcloud module creates the virtualhost at hostName; we override
# its listen address here.
services.nginx.virtualHosts.${config.services.nextcloud.hostName}.listen = [
{
addr = "127.0.0.1";
port = 8081;
}
];
# The cron timer can fire before nextcloud-setup.service has finished on
# first boot, causing a "Not installed" failure. Make the cron service wait
# for setup to complete before it's allowed to run.
systemd.services.nextcloud-cron = {
after = [ "nextcloud-setup.service" ];
requires = [ "nextcloud-setup.service" ];
};
}