Topology: Basic test
This commit is contained in:
26
flake.nix
26
flake.nix
@ -155,24 +155,24 @@
|
|||||||
commonModules = [
|
commonModules = [
|
||||||
# inputs.agenix.nixosModules.default
|
# inputs.agenix.nixosModules.default
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
inputs.nix-topology.nixosModules.default
|
||||||
# TODO: inputs.nix-topology.nixosModules.default
|
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
# Local shell for NixFlake directory
|
# Local shell for NixFlake directory
|
||||||
devShells."${system}".default = import ./shell.nix {inherit pkgs;};
|
devShells.${system}.default = import ./shell.nix {inherit pkgs;};
|
||||||
|
|
||||||
# TODO: Add my homelab configs into this flake, then add a topology config for each host
|
|
||||||
# Output that generates a system topology diagram
|
# Output that generates a system topology diagram
|
||||||
# topology = import inputs.nix-topology {
|
topology.${system} = import inputs.nix-topology {
|
||||||
# inherit pkgs; # Only this package set must include nix-topology.overlays.default
|
inherit pkgs; # Only this package set must include nix-topology.overlays.default
|
||||||
# modules = [
|
modules = [
|
||||||
# # Your own file to define global topology. Works in principle like a nixos module but uses different options.
|
# Your own file to define global topology.
|
||||||
# # ./topology.nix
|
# Works in principle like a nixos module but uses different options.
|
||||||
# # Inline module to inform topology of your existing NixOS hosts.
|
./topology/topology.nix
|
||||||
# {nixosConfigurations = self.nixosConfigurations;}
|
|
||||||
# ];
|
# Inline module to inform topology of your existing NixOS hosts.
|
||||||
# };
|
{inherit (self) nixosConfigurations;}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# We give each configuration a (host)name to choose a configuration when rebuilding.
|
# We give each configuration a (host)name to choose a configuration when rebuilding.
|
||||||
# This makes it easy to add different configurations (e.g. for a laptop).
|
# This makes it easy to add different configurations (e.g. for a laptop).
|
||||||
|
BIN
topology/images/ProtectliVaultFW2B.png
Normal file
BIN
topology/images/ProtectliVaultFW2B.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 KiB |
BIN
topology/images/TPLinkTLSG108E.jpg
(Stored with Git LFS)
Normal file
BIN
topology/images/TPLinkTLSG108E.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
39
topology/topology.nix
Normal file
39
topology/topology.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{config, ...}: let
|
||||||
|
inherit (config.lib.topology) mkInternet mkRouter mkConnection mkSwitch;
|
||||||
|
in {
|
||||||
|
# Add a node for the internet
|
||||||
|
nodes.internet = mkInternet {
|
||||||
|
connections = mkConnection "router" "wan1";
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.switch = mkSwitch "Switch" {
|
||||||
|
info = "TP-Link TL-SG108E";
|
||||||
|
image = ./images/TPLinkTLSG108E.jpg;
|
||||||
|
interfaceGroups = [["eth0" "eth1" "eth2" "eth3" "eth4" "eth5" "eth6" "eth7"]];
|
||||||
|
# connections.eth1 = mkConnection "host1" "lan";
|
||||||
|
# connections.eth2 = [(mkConnection "host2" "wan") (mkConnection "host3" "eth0")];
|
||||||
|
|
||||||
|
# any other attributes specified here are directly forwarded to the node:
|
||||||
|
interfaces.eth1.network = "home";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add a router that we use to access the internet
|
||||||
|
nodes.router = mkRouter "Firewall" {
|
||||||
|
info = "Protectli Vault FW2B";
|
||||||
|
image = ./images/ProtectliVaultFW2B.png;
|
||||||
|
interfaceGroups = [
|
||||||
|
["wan1"]
|
||||||
|
["eth1"]
|
||||||
|
];
|
||||||
|
connections.eth1 = mkConnection "switch" "eth0";
|
||||||
|
interfaces.eth1 = {
|
||||||
|
addresses = ["192.168.86.5"];
|
||||||
|
network = "home";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networks.home = {
|
||||||
|
name = "Mafia Home";
|
||||||
|
cidrv4 = "192.168.86.0/24";
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user