feat: topology

This commit is contained in:
Patrick 2024-12-12 20:12:36 +01:00
parent c197d629a3
commit 1d2e32b8b0
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
11 changed files with 197 additions and 17 deletions

View file

@ -1522,12 +1522,13 @@
"pre-commit-hooks": "pre-commit-hooks_3"
},
"locked": {
"lastModified": 1732192922,
"narHash": "sha256-xQO/3I99TFdiXTN5VoS28NpbNlCQWQUvxmPQHlfkzmU=",
"owner": "oddlama",
"repo": "nix-topology",
"rev": "2b107e98bbde932a363874e0ef5b1739a932bbc5",
"type": "github"
"lastModified": 1733919075,
"narHash": "sha256-qr0HiP+YEuMJWkEsM3KBQkIvfBjA4VFvV6gC43Ize2o=",
"ref": "refs/heads/fix-container-mvlan",
"rev": "f4f7786d315beb8d7c65665b7cfc7260a988d89f",
"revCount": 152,
"type": "git",
"url": "file:///home/patrick/repos/nix/nix-topology/fix-container-mvlan"
},
"original": {
"owner": "oddlama",

View file

@ -69,4 +69,5 @@
programs.streamcontroller.enable = true;
hardware.opentabletdriver.enable = true;
topology.self.icon = "devices.desktop";
}

View file

@ -81,4 +81,5 @@
kexecTime = "1m";
};
};
topology.self.interfaces.lan.network = "home";
}

View file

@ -27,20 +27,13 @@ let
actual = "actual";
firefly = "money";
homebox = "homebox";
octoprint = "print";
invidious = "yt";
blog = "blog";
};
in
"${domains.${hostName}}.${config.secrets.secrets.global.domains.web}";
# TODO hard coded elisabeth nicht so schön
ipOf =
hostName:
if hostName == "octoprint" then
#nodes.testienix.config.wireguard.elisabeth.ipv4
"0.0.0.0"
else
nodes."elisabeth-${hostName}".config.wireguard.elisabeth.ipv4;
ipOf = hostName: nodes."elisabeth-${hostName}".config.wireguard.elisabeth.ipv4;
in
{
services.netbird.server.proxy =
@ -161,7 +154,6 @@ in
(blockOf "blog" { port = 80; })
(blockOf "homebox" { })
(proxyProtect "ollama" { } true)
(proxyProtect "octoprint" { } true)
(proxyProtect "firefly" { port = 80; } true)
(blockOf "apispotify" {
port = 3000;

View file

@ -16,4 +16,5 @@
"virtio_blk"
];
nixpkgs.hostPlatform = "x86_64-linux";
topology.self.icon = "devices.cloud-server";
}

View file

@ -33,4 +33,5 @@
createHome = false;
};
users.groups.nix-build = { };
topology.self.icon = "devices.cloud-server";
}

View file

@ -44,4 +44,5 @@
"kvm"
"nixos-test"
];
topology.self.icon = "devices.laptop";
}

View file

@ -1 +1,182 @@
{ }
{ config, ... }:
let
inherit (config.lib.topology)
mkInternet
mkRouter
mkConnection
mkSwitch
mkDevice
;
in
{
networks = {
home = {
name = "Heimnetz";
cidrv4 = "192.168.178.0/24";
};
};
nodes = {
internet = mkInternet {
connections = [
(mkConnection "fritzbox" "wan1")
(mkConnection "mailnix" "lan01")
(mkConnection "maddy" "lan01")
];
};
fritzbox = mkRouter "FritzBox" {
info = "FRITZ!Box 7520";
interfaceGroups = [
[
"wan1"
]
[
"eth1"
"eth2"
"eth3"
]
];
interfaces.eth1 = {
addresses = [ "192.168.178.1" ];
network = "home";
};
connections.eth1 = mkConnection "switch-ganzoben" "eth1";
};
switch-ganzoben = mkSwitch "Switch Ganzoben" {
info = "TPLink 16 Port";
interfaceGroups = [
[
"eth1"
"eth2"
"eth3"
"eth4"
"eth5"
"eth6"
"eth7"
"eth8"
"eth9"
"eth10"
"eth11"
"eth12"
"eth13"
"eth14"
"eth15"
"eth16"
]
];
connections = {
eth2 = mkConnection "switch-waschkueche" "eth1";
eth3 = mkConnection "switch-patrick" "eth5";
eth4 = mkConnection "docking-station-ganzoben" "lan";
eth5 = mkConnection "desktop-ganzoben" "lan";
eth9 = mkConnection "drucker" "lan";
eth10 = mkConnection "homematic" "lan";
eth11 = mkConnection "raspberry-pi" "lan";
eth12 = mkConnection "fernseher" "lan";
eth16 = mkConnection "devolo" "lan";
};
};
switch-waschkueche = mkSwitch "Switch Waschküche" {
info = "TPLink 8 Port";
interfaceGroups = [
[
"eth1"
"eth2"
"eth3"
"eth4"
"eth5"
"eth6"
"eth7"
"eth8"
]
];
connections = {
eth2 = mkConnection "switch-server" "eth1";
eth3 = mkConnection "desktop-david" "lan";
eth7 = mkConnection "solar-anlage" "lan";
eth8 = mkConnection "solar-anlage" "lan";
};
};
switch-server = mkSwitch "Switch Server" {
info = "TPLink 5 Port";
interfaceGroups = [
[
"eth1"
"eth2"
"eth3"
"eth4"
"eth5"
]
];
connections = {
eth2 = mkConnection "elisabeth" "lan01";
eth3 = mkConnection "homematic-ip" "lan";
eth4 = mkConnection "dect" "lan";
eth5 = mkConnection "docking-station-keller" "lan";
};
};
switch-patrick = mkSwitch "Switch Patrick" {
info = "5 Port";
interfaceGroups = [
[
"eth1"
"eth2"
"eth3"
"eth4"
"eth5"
]
];
connections = {
eth4 = mkConnection "desktopnix" "lan01";
eth3 = mkConnection "patricknix" "lan01";
};
};
docking-station-ganzoben = mkDevice "Docking Station Ganzoben" {
info = "Docking Station";
interfaces.lan = { };
};
desktop-ganzoben = mkDevice "Desktop Ganzoben" {
info = "Desktop";
interfaces.lan = { };
};
drucker = mkDevice "Drucker" {
info = "HP Drucker";
interfaces.lan = { };
};
homematic = mkDevice "homematic" {
info = "Homematic zentrale";
interfaces.lan = { };
};
raspberry-pi = mkDevice "RaspberryPi" {
info = "Raspberry-Pi 5";
interfaces.lan = { };
};
fernseher = mkDevice "fernseher" {
info = "LG? Fernseher";
interfaces.lan = { };
};
devolo = mkDevice "devolo" {
info = "devolo";
interfaces.lan = { };
};
solar-anlage = mkDevice "solar" {
info = "solar anlage+batterie";
interfaces.lan = { };
};
desktop-david = mkDevice "desktop-david" {
info = "Desktop";
interfaces.lan = { };
};
homematic-ip = mkDevice "homematic-ip" {
info = "homematic-ip point";
interfaces.lan = { };
};
dect = mkDevice "dect" {
info = "Teflon";
interfaces.lan = { };
};
docking-station-keller = mkDevice "Docking-station Keller" {
info = "Für die kellerarbeiter";
interfaces.lan = { };
};
};
}

Binary file not shown.

View file

@ -28,7 +28,7 @@ lib.optionalAttrs (!minimal) {
services.libinput = {
enable = true;
mouse = {
accelSpeed = "0.5";
accelSpeed = "0.3";
accelProfile = "flat";
middleEmulation = false;
};

View file

@ -2,6 +2,7 @@
hm.programs.direnv = {
enable = true;
nix-direnv.enable = true;
config.warn_timout = "1m";
};
hm.home.persistence."/state".directories = [
".local/share/direnv"