From 2cc3da022c92bfbae96704ba70a887cb36384f82 Mon Sep 17 00:00:00 2001 From: glenn Date: Thu, 25 Jul 2024 10:20:17 +0200 Subject: [PATCH] configure reverse proxy for ai --- ai.nix | 22 +++++++++++++++++++++ flake.nix | 59 +++++++++++++++++++++++++++++++------------------------ 2 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 ai.nix diff --git a/ai.nix b/ai.nix new file mode 100644 index 0000000..71b86e9 --- /dev/null +++ b/ai.nix @@ -0,0 +1,22 @@ +{ + self, + config, + lib, + pkgs, + ... +}: let + domain = "ai.sondell.org"; +in { + services.nginx.virtualHosts = { + ${domain} = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:9876/"; + proxyWebsockets = true; + }; + # Use DNS Challenege. + # acmeRoot = null; + }; + }; +} diff --git a/flake.nix b/flake.nix index f7c8353..6141bc6 100644 --- a/flake.nix +++ b/flake.nix @@ -13,10 +13,15 @@ url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; inputs.nixpkgs.follows = "nixpkgs"; }; -}; + }; - outputs = { self, nixpkgs, home, nixos-mailserver, home-manager}@attrs: - let + outputs = { + self, + nixpkgs, + home, + nixos-mailserver, + home-manager, + } @ attrs: let system = "x86_64-linux"; homepage = home.packages.${system}.default; mailserver = nixos-mailserver.nixosModules.default; @@ -32,29 +37,31 @@ home-manager.nixosModules.home-manager homeSettings ]; - in - { + in { # replace 'joes-desktop' with your hostname here. - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem - { - inherit system; - specialArgs = attrs; - modules = [ - ./configuration.nix - ./audiobooks.nix - ./tunnel.nix - ./forgejo.nix - ./nextcloud.nix - ./jellyfin.nix - ./filebrowser.nix - ./tail.nix - ./matrix.nix - ./coturn.nix - ./vaultwarden.nix - (import ./mail.nix {inherit mailserver;}) - (import ./homepage.nix {inherit homepage;}) - ] ++ homeModules; - - }; + nixosConfigurations.nixos = + nixpkgs.lib.nixosSystem + { + inherit system; + specialArgs = attrs; + modules = + [ + ./configuration.nix + ./audiobooks.nix + ./tunnel.nix + ./forgejo.nix + ./nextcloud.nix + ./jellyfin.nix + ./filebrowser.nix + ./tail.nix + ./ai.nix + ./matrix.nix + ./coturn.nix + ./vaultwarden.nix + (import ./mail.nix {inherit mailserver;}) + (import ./homepage.nix {inherit homepage;}) + ] + ++ homeModules; + }; }; }