nixos/authelia.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

94 lines
2.6 KiB
Nix

{ config, ... }:
{
# Give authelia-main user access to its agenix secrets
age.secrets."authelia-jwt-secret" = {
file = ./secrets/authelia-jwt-secret.age;
owner = "authelia-main";
group = "authelia-main";
};
age.secrets."authelia-storage-key" = {
file = ./secrets/authelia-storage-key.age;
owner = "authelia-main";
group = "authelia-main";
};
age.secrets."authelia-session-secret" = {
file = ./secrets/authelia-session-secret.age;
owner = "authelia-main";
group = "authelia-main";
};
age.secrets."authelia-users" = {
file = ./secrets/authelia-users.age;
owner = "authelia-main";
group = "authelia-main";
};
# Expose overrideable portal assets from this repository.
environment.etc."authelia/assets".source = ./authelia-assets;
services.authelia.instances.main = {
enable = true;
secrets = {
jwtSecretFile = config.age.secrets."authelia-jwt-secret".path;
storageEncryptionKeyFile = config.age.secrets."authelia-storage-key".path;
sessionSecretFile = config.age.secrets."authelia-session-secret".path;
};
settings = {
theme = "auto";
default_2fa_method = "totp";
server.address = "tcp://127.0.0.1:9091";
server.asset_path = "/etc/authelia/assets";
log.level = "info";
totp = {
disable = false;
issuer = "reudy.net";
period = 30;
};
webauthn.disable = true;
# File-based user database (simplest, no LDAP needed)
authentication_backend.file = {
path = config.age.secrets."authelia-users".path;
watch = false;
};
# SQLite is the simplest storage - fine for a single VPS
storage.local.path = "/var/lib/authelia-main/db.sqlite3";
# No email server needed for a homelab — disable email notifications
notifier.filesystem.filename = "/var/lib/authelia-main/notifications.txt";
session = {
expiration = "1h";
inactivity = "5m";
remember_me = "1d";
cookies = [
{
domain = "reudy.net";
authelia_url = "https://auth.reudy.net";
default_redirection_url = "https://hello.reudy.net";
}
];
};
access_control = {
# Every request requires two-factor by default
default_policy = "two_factor";
# You can add per-domain rules here later, e.g.:
# rules = [
# { domain = "hello.reudy.net"; policy = "two_factor"; }
# ];
};
regulation = {
max_retries = 5;
};
};
};
}