Skip to content

Commit

Permalink
move more things into registry
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Nov 27, 2023
1 parent d413aeb commit 3bd250c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
20 changes: 4 additions & 16 deletions hosts/tram-borzoi/borzoi.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
7 changes: 3 additions & 4 deletions hosts/tram-borzoi/postgres.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
11 changes: 8 additions & 3 deletions modules/traffic-stop-box/radio-config.nix
Original file line number Diff line number Diff line change
@@ -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;
};
Expand Down
11 changes: 11 additions & 0 deletions registry/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
}

0 comments on commit 3bd250c

Please sign in to comment.