matrix: support via a locations api
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2023-04-29 19:20:42 +01:00
parent 91d132a9a0
commit 3058e4eb50
4 changed files with 29 additions and 1 deletions

View File

@ -20,6 +20,7 @@
## Custom Services
custom = {
locations.autoServe = true;
www.global.enable = true;
services.matrix.enable = true;
};

View File

@ -4,6 +4,7 @@
imports = [
./backups/default.nix
./desktop/awesome/default.nix
./locations.nix
./resilio.nix
./services/matrix.nix
./tailscale.nix

25
modules/locations.nix Normal file
View File

@ -0,0 +1,25 @@
{ config, lib, ... }:
let
cfg = config.custom.locations;
in
{
options.custom.locations = {
autoServe = lib.mkOption {
default = false;
type = lib.types.bool;
};
locations = lib.mkOption {
default = {
services = {
matrix = "vm.strangervm.ts.hillion.co.uk";
};
};
};
};
config = lib.mkIf cfg.autoServe {
custom.services.matrix.enable = cfg.locations.services.matrix == config.networking.fqdn;
};
}

View File

@ -2,6 +2,7 @@
let
cfg = config.custom.www.global;
locations = config.custom.locations.locations;
in
{
options.custom.www.global = {
@ -39,7 +40,7 @@ in
reverse_proxy http://plex.mediaserver.ts.hillion.co.uk:8096
'';
virtualHosts."matrix.hillion.co.uk".extraConfig = ''
reverse_proxy http://vm.strangervm.ts.hillion.co.uk:8008
reverse_proxy http://${locations.services.matrix}:8008
'';
virtualHosts."unifi.hillion.co.uk".extraConfig = ''
reverse_proxy https://unifi.unifi.ts.hillion.co.uk:8443 {