From a3d887ef8d903968a8df974e5ac38599b6cf9f09 Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Wed, 5 Feb 2025 21:08:52 +0100 Subject: [PATCH] Add authentik --- roles/authentik.nix | 46 +++++++++++++++++++++++++++++++++++++++++++++ roles/default.nix | 1 + roles/sonarr.nix | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 roles/authentik.nix diff --git a/roles/authentik.nix b/roles/authentik.nix new file mode 100644 index 0000000..64fc375 --- /dev/null +++ b/roles/authentik.nix @@ -0,0 +1,46 @@ +{ + name = "Authentik"; + description = '' + SSO provider + ''; + + traefikRoutes = + { + host, + ... + }: + let + hostname = host.hostname; + config = host.config.authentik; + in + [ + { + name = "${hostname}-authentik"; + rule = "Host(`${config.domain}`)"; + # TODO: Change port + target = "http://${host.ip}:PORTHERE"; + } + ]; + + nixosModule = + { lib, ... }: + { + options.authentik = { + domain = lib.mkOption { + type = lib.types.str; + }; + }; + + config = { + # Enable the sonarr service + services.sonarr = { + enable = true; + openFirewall = true; + group = "media"; + }; + + # Ensure that the media group exists + users.groups.media = { }; + }; + }; +} diff --git a/roles/default.nix b/roles/default.nix index 37eab5f..d034834 100644 --- a/roles/default.nix +++ b/roles/default.nix @@ -5,4 +5,5 @@ { sonarr = utils.mkRole (import ./sonarr.nix); traefik = utils.mkRole (import ./traefik.nix); + authentik = utils.mkRole (import ./authentik.nix); } diff --git a/roles/sonarr.nix b/roles/sonarr.nix index 6c68860..dce6fe9 100644 --- a/roles/sonarr.nix +++ b/roles/sonarr.nix @@ -26,7 +26,7 @@ { options.sonarr = { domain = lib.mkOption { - type = lib.types.listOf lib.types.str; + type = lib.types.str; }; };