From e158c951338ac09d544a1db9c88b032ad216d285 Mon Sep 17 00:00:00 2001 From: Lgmrszd Date: Wed, 15 May 2024 22:14:50 +0300 Subject: [PATCH] vps1: reorganize data a bit --- hosts/vps1/configuration.nix | 2 +- hosts/vps1/data/default.nix | 11 ++++++++++- hosts/vps1/data/host.toml | 1 + hosts/vps1/data/services.toml | 2 -- hosts/vps1/services/git.nix | 7 +++---- 5 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 hosts/vps1/data/host.toml 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";