diff --git a/hosts/vps1/configuration.nix b/hosts/vps1/configuration.nix index 3283265..9fe576a 100644 --- a/hosts/vps1/configuration.nix +++ b/hosts/vps1/configuration.nix @@ -1,6 +1,6 @@ { pkgs, config, data, ... }: let - inherit (data.services) rootDomain; + inherit (data.host) rootDomain; gtnhDomain = "gtnh.${rootDomain}"; discDomain = "discourse.testdrive.${rootDomain}"; akkoDomain = "akko429164.testdrive.${rootDomain}"; diff --git a/hosts/vps1/data/default.nix b/hosts/vps1/data/default.nix index 635e1f4..306046e 100644 --- a/hosts/vps1/data/default.nix +++ b/hosts/vps1/data/default.nix @@ -1,3 +1,12 @@ -{ +let + host = builtins.fromTOML (builtins.readFile ./host.toml); + rootDomain = host.rootDomain; services = builtins.fromTOML (builtins.readFile ./services.toml); +in +{ + inherit host; + services = builtins.mapAttrs (name: values: + values // + (if values ? subdomain then {domain = "${values.subdomain}.${rootDomain}";} else {}) + ) services; } \ No newline at end of file diff --git a/hosts/vps1/data/host.toml b/hosts/vps1/data/host.toml new file mode 100644 index 0000000..dbb8e40 --- /dev/null +++ b/hosts/vps1/data/host.toml @@ -0,0 +1 @@ +rootDomain = "lgmrszd.xyz" \ No newline at end of file diff --git a/hosts/vps1/data/services.toml b/hosts/vps1/data/services.toml index 772f5f0..9046bce 100644 --- a/hosts/vps1/data/services.toml +++ b/hosts/vps1/data/services.toml @@ -1,5 +1,3 @@ -rootDomain = "lgmrszd.xyz" - [git] subdomain = "git" sshPort = 22631 diff --git a/hosts/vps1/services/git.nix b/hosts/vps1/services/git.nix index 74edd68..315f7e9 100644 --- a/hosts/vps1/services/git.nix +++ b/hosts/vps1/services/git.nix @@ -1,9 +1,8 @@ # Big thanks to Pyrox for their config! https://git.pyrox.dev/pyrox/nix/src/branch/main/hosts/marvin/services/git.nix { lib, pkgs, config, data, ... }: let - inherit (data.services) rootDomain; - domain = "${data.services.git.subdomain}.${rootDomain}"; - gitSSHPort = data.services.git.sshPort; + inherit (data.host) rootDomain; + inherit (data.services.git) domain sshPort; cfg = config.services.forgejo; srv = cfg.settings.server; @@ -40,7 +39,7 @@ in ROOT_URL = "https://${srv.DOMAIN}/"; HTTP_ADDR = "127.0.0.1"; HTTP_PORT = 3001; - SSH_PORT = gitSSHPort; + SSH_PORT = sshPort; }; DEFAULT = { APP_NAME = "Lgmrszd's git";