diff --git a/hosts/marty-server/options.nix b/hosts/marty-server/options.nix index 75cbc6c..f572036 100644 --- a/hosts/marty-server/options.nix +++ b/hosts/marty-server/options.nix @@ -152,10 +152,5 @@ }; }; }; - server = { - synapse = { - subdomain = "yap"; - }; - }; }; } diff --git a/modules/device/server.nix b/modules/device/server.nix index 2085aba..1908981 100644 --- a/modules/device/server.nix +++ b/modules/device/server.nix @@ -6,5 +6,66 @@ }: { - config = { }; + config = { + server = { + arr = { + enable = true; + }; + cloud = { + immich = { + enable = true; + public = true; + }; + nextcloud = { + enable = true; + public = true; + }; + }; + media = { + jellyfin = { + enable = true; + public = false; + }; + jellyseer = { + enable = true; + public = false; + }; + kavita = { + enable = true; + public = false; + }; + navidrome = { + enable = true; + public = false; + }; + }; + misc = { + dawarich = { + enable = true; + public = false; + }; + forgejo = { + enable = true; + public = true; + }; + lauti = { + enable = true; + public = true; + }; + vaultwarden = { + enable = true; + public = true; + }; + }; + social = { + gotosocial = { + enable = true; + public = true; + }; + synapse = { + enable = true; + }; + }; + }; + }; } diff --git a/modules/server/media/default.nix b/modules/server/media/default.nix index 876a42d..dd099ee 100644 --- a/modules/server/media/default.nix +++ b/modules/server/media/default.nix @@ -8,6 +8,7 @@ { imports = [ ./jellyfin.nix + ./kavita.nix ./navidrome.nix ]; } diff --git a/modules/server/media/jellyfin.nix b/modules/server/media/jellyfin.nix index 67c4eab..58a58c2 100644 --- a/modules/server/media/jellyfin.nix +++ b/modules/server/media/jellyfin.nix @@ -6,9 +6,9 @@ }: { - options.server = { + options.server.media = { jellyfin = { - enable = lib.mkEnableOption "enable jelyfin"; + enable = lib.mkEnableOption "enable jellyfin"; port = lib.mkOption { default = 8096; description = "set jellyfin port"; @@ -36,7 +36,7 @@ environment.systemPackages = [ ] ++ ( - if config.server.jellyfin.enable then + if config.server.media.jellyfin.enable then [ pkgs.jellyfin pkgs.jellyfin-web @@ -46,30 +46,30 @@ [ ] ); services = { - jellyfin = lib.mkIf config.server.jellyfin.enable { + jellyfin = lib.mkIf config.server.media.jellyfin.enable { enable = true; }; - seerr = lib.mkIf config.server.jellyseer.enable { + seerr = lib.mkIf config.server.media.jellyseer.enable { enable = true; }; nginx.virtualHosts = { - "${config.server.jellyfin.subdomain}.${config.networking.domain}" = - lib.mkIf config.server.jellyfin.public + "${config.server.media.jellyfin.subdomain}.${config.networking.domain}" = + lib.mkIf config.server.media.jellyfin.public { enableACME = true; forceSSL = true; locations."/" = { - proxyPass = "http://127.0.0.1:${config.server.jellyfin.port}"; + proxyPass = "http://127.0.0.1:${config.server.media.jellyfin.port}"; }; }; - "${config.server.jellyseer.subdomain}.${config.networking.domain}" = - lib.mkIf config.server.jellyfin.public + "${config.server.media.jellyseer.subdomain}.${config.networking.domain}" = + lib.mkIf config.server.media.jellyseer.public { enableACME = true; forceSSL = true; locations."/" = { - proxyPass = "http://127.0.0.1:${config.server.jellyseer.port}"; + proxyPass = "http://127.0.0.1:${config.server.media.jellyseer.port}"; }; }; }; diff --git a/modules/server/media/kavita.nix b/modules/server/media/kavita.nix new file mode 100644 index 0000000..e31580a --- /dev/null +++ b/modules/server/media/kavita.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + options = { + server.media.kavita = { + enable = lib.mkEnableOption "enable kavita"; + port = lib.mkOption { + default = 3812; + description = "kavita port"; + }; + public = lib.mkEnableOption "make kavita public"; + subdomain = lib.mkOption { + default = "books"; + description = "kavita subdomain"; + }; + }; + }; + config = { + services = { + kavita = { + enable = config.server.media.kavita.enable; + user = config.user.userName; + settings = { + Port = config.server.media.kavita.port; + }; + }; + nginx = { + virtualHosts = { + "${config.server.media.kavita.subdomain}.${config.networking.domain}" = + if config.server.media.kavita.public then + { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.server.media.kavita.port}"; + }; + } + else + { }; + }; + }; + }; + }; +} diff --git a/modules/server/misc/lauti.nix b/modules/server/misc/lauti.nix index 8606f0a..5ba0bd5 100644 --- a/modules/server/misc/lauti.nix +++ b/modules/server/misc/lauti.nix @@ -4,9 +4,7 @@ pkgs, ... }: -let - domain = "${config.server.misc.lauti.subdomain}.${config.networking.domain}"; -in + { options = { server.misc.lauti = { @@ -17,7 +15,7 @@ in }; public = lib.mkEnableOption "make lauti public"; domain = lib.mkOption { - default = ""; + default = "calendar"; description = "lauti domain"; }; subdomain = lib.mkOption { @@ -32,7 +30,7 @@ in enable = config.server.misc.lauti.enable; settings = { LAUTI_ADMIN_EMAIL = "lauti@${config.networking.domain}"; - LAUTI_BASE_URL = "https://${domain}"; + LAUTI_BASE_URL = "https://${config.server.misc.lauti.subdomain}.${config.networking.domain}"; LAUTI_OSM_TILE_CACHE_DIR = "/var/lib/lauti/osm"; LAUTI_OSM_TILE_SERVER = "https://tile.openstreetmap.org/{z}/{x}/{y}.png"; LAUTI_TIMEZONE = "Europe/Berlin"; @@ -42,7 +40,7 @@ in }; nginx = { virtualHosts = { - "${domain}" = + "${config.server.misc.lauti.subdomain}.${config.networking.domain}" = if config.server.misc.lauti.public then { enableACME = true; diff --git a/modules/server/social/synapse.nix b/modules/server/social/synapse.nix index e734ae1..aba373b 100644 --- a/modules/server/social/synapse.nix +++ b/modules/server/social/synapse.nix @@ -19,7 +19,7 @@ in { options = { - server.synapse = { + server.social.synapse = { enable = lib.mkEnableOption "enable synapse"; subdomain = lib.mkOption { default = "yap"; @@ -33,7 +33,7 @@ in }; config = { services = - if config.server.synapse.enable then + if config.server.social.synapse.enable then { postgresql.enable = true; matrix-synapse = { @@ -68,7 +68,7 @@ in }; listeners = [ { - port = config.server.synapse.port; + port = config.server.social.synapse.port; bind_addresses = [ "127.0.0.1" ]; type = "http"; tls = false; @@ -94,12 +94,12 @@ in locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig; locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig; }; - "${config.server.synapse.subdomain}.${config.networking.domain}" = { + "${config.server.social.synapse.subdomain}.${config.networking.domain}" = { enableACME = true; forceSSL = true; locations = { "~ ^(/_matrix|/_synapse/client|/)" = { - proxyPass = "http://127.0.0.1:${toString config.server.synapse.port}"; + proxyPass = "http://127.0.0.1:${toString config.server.social.synapse.port}"; proxyWebsockets = true; extraConfig = "proxy_set_header X-Forwarded-For $remote_addr;"