Compare commits
3 commits
f84eb995cd
...
601fc03e32
Author | SHA1 | Date | |
---|---|---|---|
601fc03e32 | |||
f39a48c425 | |||
7422adb13a |
21 changed files with 41 additions and 32 deletions
cluster/services
c-f32aebf5
consul
dns
ipfs
meet
ways
websites
hosts
lib
modules
secrets.nix
|
@ -1,4 +1,4 @@
|
|||
{ config, depot, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cid = "c-f32aebf5";
|
||||
|
@ -28,7 +28,7 @@ in
|
|||
{
|
||||
links.${cid} = {
|
||||
protocol = "http";
|
||||
ipv4 = depot.reflection.interfaces.primary.addrPublic;
|
||||
ipv4 = config.reflection.interfaces.primary.addrPublic;
|
||||
};
|
||||
|
||||
users.users.${cid} = {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ depot, lib, ... }:
|
||||
{ config, depot, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (depot.lib.meta) domain;
|
||||
frontendDomain = "consul-remote.internal.${domain}";
|
||||
|
||||
inherit (depot.reflection.interfaces.vstub) addr;
|
||||
inherit (config.reflection.interfaces.vstub) addr;
|
||||
in
|
||||
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ cluster, config, depot, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (depot.reflection) interfaces;
|
||||
inherit (config.reflection) interfaces;
|
||||
inherit (depot.lib.meta) domain;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ cluster, config, depot, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (depot.reflection) interfaces hyprspace;
|
||||
inherit (config.reflection) interfaces;
|
||||
inherit (depot.lib.meta) domain;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ config, depot, lib, ... }:
|
||||
|
||||
{
|
||||
hostLinks = lib.genAttrs config.services.ipfs.nodes.node (name: depot.lib.summon name ({ depot, ... }: let
|
||||
host = depot.reflection;
|
||||
hostLinks = lib.genAttrs config.services.ipfs.nodes.node (name: let
|
||||
host = depot.hours.${name};
|
||||
intf = host.interfaces.primary;
|
||||
self = config.hostLinks.${name}.ipfs;
|
||||
in {
|
||||
|
@ -20,7 +20,7 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
}));
|
||||
});
|
||||
services.ipfs = {
|
||||
nodes = {
|
||||
node = [ "VEGAS" "prophet" ];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
let
|
||||
inherit (config) links;
|
||||
|
||||
inherit (depot.reflection) interfaces;
|
||||
inherit (config.reflection) interfaces;
|
||||
in
|
||||
{
|
||||
links = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ cluster, config, depot, lib, pkgs, ... }:
|
||||
{ cluster, config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
externalWays = lib.filterAttrs (_: cfg: !cfg.internal) cluster.config.ways;
|
||||
|
@ -91,7 +91,7 @@ in
|
|||
mode = "external";
|
||||
definition = {
|
||||
name = "ways-proxy";
|
||||
address = depot.reflection.interfaces.primary.addrPublic;
|
||||
address = config.reflection.interfaces.primary.addrPublic;
|
||||
port = 443;
|
||||
checks = lib.singleton {
|
||||
interval = "60s";
|
||||
|
|
|
@ -33,7 +33,7 @@ in
|
|||
mode = "external";
|
||||
definition = {
|
||||
name = "static-lb";
|
||||
address = depot.reflection.interfaces.primary.addrPublic;
|
||||
address = config.reflection.interfaces.primary.addrPublic;
|
||||
port = 443;
|
||||
checks = lib.singleton {
|
||||
interval = "60s";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ depot, ... }:
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (depot.reflection) interfaces;
|
||||
inherit (config.reflection) interfaces;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
|
@ -10,7 +10,7 @@ let
|
|||
lmtpSocket = "lmtp:unix:/run/dovecot2/lmtp";
|
||||
postfixLdapMailboxes = "ldap:${config.age.secrets."postfix-ldap-mailboxes.cf".path}";
|
||||
|
||||
inherit (depot.reflection) interfaces;
|
||||
inherit (config.reflection) interfaces;
|
||||
in
|
||||
{
|
||||
age.secrets."postfix-ldap-mailboxes.cf" = {
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
"fe80::/10"
|
||||
];
|
||||
|
||||
mkRules = ipt: ranges: map (x: "${ipt} -I nixos-fw 1 -d ${x} -o ${depot.reflection.interfaces.primary.link} -j DROP") ranges;
|
||||
mkRules = ipt: ranges: map (x: "${ipt} -I nixos-fw 1 -d ${x} -o ${config.reflection.interfaces.primary.link} -j DROP") ranges;
|
||||
|
||||
rules4 = mkRules "iptables" privateIp4Ranges;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ depot, ... }:
|
||||
{ config, depot, ... }:
|
||||
|
||||
let
|
||||
inherit (depot.reflection.interfaces) primary;
|
||||
inherit (config.reflection.interfaces) primary;
|
||||
in
|
||||
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ let
|
|||
inherit (config) gods;
|
||||
|
||||
mkNixOS = name: host: nixosSystem {
|
||||
specialArgs = config.lib.summon name lib.id;
|
||||
specialArgs = config.lib.summon host.system lib.id;
|
||||
modules = [
|
||||
host.nixos
|
||||
(withSystem host.system ({ config, pkgs, ... }: {
|
||||
|
|
|
@ -5,14 +5,11 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
lib.summon = name: f: let
|
||||
lib.summon = system: f: let
|
||||
lift = config;
|
||||
hour = config.hours.${name};
|
||||
in withSystem hour.system ({ config, inputs', self', ... }: f {
|
||||
in withSystem system ({ config, inputs', self', ... }: f {
|
||||
depot = self // self' // lift // config // {
|
||||
inputs = mapAttrs (name: const (inputs.${name} // inputs'.${name})) inputs;
|
||||
# peer into the Watchman's Glass
|
||||
reflection = hour;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ config, depot, lib, ... }:
|
||||
let
|
||||
orgDomain = depot.lib.meta.domain;
|
||||
host = depot.reflection;
|
||||
host = config.reflection;
|
||||
in {
|
||||
networking.domain = lib.mkDefault "${host.enterprise.subdomain or "services"}.${orgDomain}";
|
||||
networking.search = [ config.networking.domain "search.${orgDomain}" ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, depot, ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
services.fail2ban = {
|
||||
enable = true;
|
||||
|
@ -6,7 +6,7 @@
|
|||
jails.sshd.settings.mode = "aggressive";
|
||||
ignoreIP = [
|
||||
"10.0.0.0/8"
|
||||
depot.reflection.interfaces.primary.addr
|
||||
config.reflection.interfaces.primary.addr
|
||||
];
|
||||
bantime-increment = {
|
||||
enable = true;
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
}) hyprspaceCapableNodes;
|
||||
peersFiltered = lib.filterAttrs (name: _: name != hostName) peersFormatted;
|
||||
peerList = builtins.attrValues peersFiltered;
|
||||
myNode = depot.reflection;
|
||||
myNode = config.reflection;
|
||||
listenPort = myNode.hyprspace.listenPort or 8001;
|
||||
|
||||
privateKeyFile = config.age.secrets.hyprspace-key.path;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ depot, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (depot.reflection) interfaces;
|
||||
inherit (config.reflection) interfaces;
|
||||
in
|
||||
{
|
||||
networking.interfaces = lib.mkIf (interfaces ? vstub) {
|
||||
|
|
|
@ -26,6 +26,7 @@ in
|
|||
nix-register-flakes = ./nix-register-flakes;
|
||||
patroni = ./patroni;
|
||||
port-magic = ./port-magic;
|
||||
reflection = ./reflection;
|
||||
shell-config = ./shell-config;
|
||||
ssh = ./ssh;
|
||||
system-info = ./system-info;
|
||||
|
@ -39,6 +40,7 @@ in
|
|||
minimal
|
||||
nixpkgs-config
|
||||
port-magic
|
||||
reflection
|
||||
ssh
|
||||
systemd-extras
|
||||
];
|
||||
|
|
10
modules/reflection/default.nix
Normal file
10
modules/reflection/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ config, depot, lib, ... }:
|
||||
|
||||
{
|
||||
options.reflection = lib.mkOption {
|
||||
description = "Peer into the Watchman's Glass.";
|
||||
type = lib.types.raw;
|
||||
readOnly = true;
|
||||
default = depot.hours.${config.networking.hostName};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
let
|
||||
max = (import ./users/max/userinfo.nix null).sshKeys;
|
||||
hosts = builtins.mapAttrs (_: v: v._module.specialArgs.depot.reflection)
|
||||
hosts = builtins.mapAttrs (_: v: v.config.reflection)
|
||||
(builtins.getFlake "git+file://${builtins.getEnv "PWD"}").nixosConfigurations;
|
||||
systemKeys = x: x.ssh.id.publicKey or null;
|
||||
in with hosts;
|
||||
|
|
Loading…
Add table
Reference in a new issue