move more things into registry

This commit is contained in:
Markus Schmidl 2023-11-27 01:09:30 +01:00
parent d413aeb5c0
commit 3bd250c79c
4 changed files with 26 additions and 23 deletions

View File

@ -1,23 +1,11 @@
{ config, ... }:
let
borzoi-port = 8080;
in
{ config, registry, ... }:
{
networking.firewall.allowedTCPPorts = [ borzoi-port ];
networking.firewall.allowedTCPPorts = [ registry.port-borzoi.port ];
TLMS.borzoi = {
enable = true;
http = {
host = "0.0.0.0";
port = borzoi-port;
};
database = {
host = "127.0.0.1";
port = config.services.postgresql.port;
passwordFile = config.sops.secrets.postgres-borzoi-pw.path;
user = "borzoi";
database = "borzoi";
};
http = registry.port-borzoi;
database = registry.postgres;
};
users.users.borzoi = {

View File

@ -1,4 +1,4 @@
{ lib, pkgs, config, inputs, self, ... }: {
{ lib, pkgs, config, inputs, self, registry, ... }: {
sops.secrets.postgres-borzoi-pw = {
owner = config.users.users.postgres.name;
@ -9,14 +9,13 @@
owner = config.users.users.postgres.name;
};
services.postgresql = {
inherit (registry.postgres) port;
enable = true;
enableTCPIP = true;
port = 5432;
authentication =
let
senpai-ip = self.unevaluatedNixosConfigurations.notice-me-senpai.specialArgs.registry.wgAddr4;
# TODO: fixme
uranus-ip = "10.13.37.9";
uranus-ip = self.unevaluatedNixosConfigurations.uranus.specialArgs.registry.wgAddr4;
in
pkgs.lib.mkOverride 10 ''
local all all trust

View File

@ -1,12 +1,17 @@
{ config, lib, registry, ... }:
{ self, config, lib, registry, ... }:
{
TLMS.gnuradio = {
enable = true;
} // registry.gnuradio;
TLMS.telegramDecoder = {
# find all the servers with data-accumulator configured
TLMS.telegramDecoder = let
registries = builtins.attrValues (builtins.mapAttrs (name: value: value.specialArgs.registry) self.unevaluatedNixosConfigurations);
filteredDataHoarders = builtins.filter (other: other ? port-data_accumulator) registries;
urlFromRegistry = other: "http://${other.wgAddr4}:${toString other.port-data_accumulator.port}";
in {
enable = true;
server = [ "http://10.13.37.1:8080" "http://10.13.37.5:8080" "http://10.13.37.7:8080" ];
server = builtins.map urlFromRegistry filteredDataHoarders;
configFile = registry.telegramDecoderConfig;
authTokenFile = config.sops.secrets.telegram-decoder-token.path;
};

View File

@ -33,5 +33,16 @@
wgAddr4 = "10.13.37.8";
wireguardPublicKey = "wCW+r5kAaIarvZUWf4KsJNetyHobP0nNy5QOhqmsCCs=";
publicWireguardEndpoint = null;
postgres = {
host = "127.0.0.1";
port = 5432;
passwordFile = "/run/secrets/postgres-borzoi-pw";
user = "borzoi";
database = "borzoi";
};
port-borzoi = {
host = "0.0.0.0";
port = 8080;
};
};
}