grace/dots
dotfiles/nix configs
git clone https://git.gae.moe/grace/dots
003ed04
main
1{ config , ...} : 2 3{ 4services . authelia . instances . main = { 5enable = true ; 6secrets = { 7jwtSecretFile = "/etc/secrets/authelia/jwt" ; 8storageEncryptionKeyFile = "/etc/secrets/authelia/storage" ; 9sessionSecretFile = "/etc/secrets/authelia/session" ; 10oidcHmacSecretFile = "/etc/secrets/authelia/oidc-hmac" ; 11oidcIssuerPrivateKeyFile = "/etc/secrets/authelia/oidc-key.pem" ; 12}; 13settings = { 14theme = "dark" ; 15log . level = "info" ; 16server . address = "tcp://127.0.0.1:9091/" ; 17server . endpoints . authz = { 18auth-request = { 19implementation = "AuthRequest" ; 20authn_strategies = [ { name = "CookieSession" ; } ]; 21}; 22git = { 23implementation = "AuthRequest" ; 24authn_strategies = [ 25{ 26name = "HeaderAuthorization" ; 27schemes = [ "Basic" ]; 28} 29]; 30}; 31}; 32authentication_backend = { 33password_reset . disable = true ; 34password_change . disable = true ; 35file . path = "/run/credentials/authelia-main.service/users.yml" ; 36}; 37access_control = { 38default_policy = "deny" ; 39rules = [ 40{ 41domain = [ 42"files.gae.moe" 43"books.gae.moe" 44"term.gae.moe" 45"i.git.gae.moe" 46]; 47policy = "one_factor" ; 48subject = [ "group:users" ]; 49} 50]; 51}; 52session . cookies = [ 53{ 54domain = "gae.moe" ; 55authelia_url = "https://auth.gae.moe" ; 56default_redirection_url = "https://files.gae.moe" ; 57} 58]; 59storage . local . path = "/var/lib/authelia-main/db.sqlite3" ; 60notifier . filesystem . filename = "/var/lib/authelia-main/notifications.txt" ; 61identity_providers . oidc . clients = [ 62{ 63client_id = "zipline" ; 64client_name = "Zipline" ; 65client_secret = ''{{ secret (printf "%s/zipline-client-secret" (mustEnv "CREDENTIALS_DIRECTORY")) | trim }}'' ; 66public = false ; 67authorization_policy = "one_factor" ; 68require_pkce = true ; 69pkce_challenge_method = "S256" ; 70redirect_uris = [ "https://l.gae.moe/api/auth/oauth/oidc" ]; 71scopes = [ "openid" "profile" "email" "offline_access" ]; 72response_types = [ "code" ]; 73grant_types = [ "authorization_code" "refresh_token" ]; 74token_endpoint_auth_method = "client_secret_post" ; 75userinfo_signed_response_alg = "none" ; 76} 77{ 78client_id = "immich" ; 79client_name = "Immich" ; 80client_secret = ''{{ secret (printf "%s/immich-client-secret" (mustEnv "CREDENTIALS_DIRECTORY")) | trim }}'' ; 81public = false ; 82authorization_policy = "one_factor" ; 83require_pkce = true ; 84pkce_challenge_method = "S256" ; 85redirect_uris = [ 86"https://img.gae.moe/auth/login" 87"https://img.gae.moe/user-settings" 88"app.immich:///oauth-callback" 89]; 90scopes = [ 91"openid" 92"profile" 93"email" 94]; 95response_types = [ "code" ]; 96grant_types = [ "authorization_code" ]; 97token_endpoint_auth_method = "client_secret_basic" ; 98userinfo_signed_response_alg = "none" ; 99} 100{ 101client_id = "jellyfin" ; 102client_name = "Jellyfin" ; 103client_secret = ''{{ secret (printf "%s/jellyfin-client-secret" (mustEnv "CREDENTIALS_DIRECTORY")) | trim }}'' ; 104public = false ; 105authorization_policy = "one_factor" ; 106require_pkce = true ; 107pkce_challenge_method = "S256" ; 108redirect_uris = [ "https://fin.gae.moe/sso/OID/redirect/authelia" ]; 109scopes = [ 110"openid" 111"profile" 112"groups" 113]; 114response_types = [ "code" ]; 115grant_types = [ "authorization_code" ]; 116token_endpoint_auth_method = "client_secret_post" ; 117userinfo_signed_response_alg = "none" ; 118} 119]; 120}; 121}; 122 123systemd . services . authelia-main . serviceConfig . LoadCredential = [ 124"zipline-client-secret:/etc/secrets/authelia/zipline-client-secret" 125"users.yml:/etc/secrets/authelia/users.yml" 126"immich-client-secret:/etc/secrets/authelia/immich-client-secret" 127"jellyfin-client-secret:/etc/secrets/authelia/jellyfin-client-secret" 128]; 129environment . systemPackages = [ config . services . authelia . instances . main . package ]; 130}