2 Commits

Author SHA1 Message Date
84e196cea0 WIP: router: mega modularization 2025-06-06 01:46:01 -07:00
94a8d00b28 router: enable xfce desktop for debugging 2025-06-06 01:00:33 -07:00
10 changed files with 23 additions and 97 deletions

View File

@@ -37,19 +37,6 @@
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
};
mkRouter = hostFile: nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
secrix.nixosModules.default
./modules
./modules/router
./hosts/common.nix
hostFile
./users/cazzzer
(hmModule ./home/common.nix)
];
};
in
{
apps.x86_64-linux.secrix = secrix.secrix self;
@@ -90,9 +77,17 @@
(hmModule ./home/cazzzer-pc.nix)
];
};
router = mkRouter ./hosts/router;
router-1 = mkRouter ./hosts/router-1;
router-2 = mkRouter ./hosts/router-2;
router = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
secrix.nixosModules.default
./modules
./hosts/common.nix
./hosts/router
./users/cazzzer
(hmModule ./home/common.nix)
];
};
};
# https://github.com/nix-community/nixos-generators?tab=readme-ov-file#using-in-a-flake
packages.x86_64-linux = {

View File

@@ -1,24 +0,0 @@
{
imports = [
../hw-vm.nix
];
router = {
enableDesktop = false;
enableDhcpClient = false;
wanMAC = "bc:24:11:af:bd:84";
lanMAC = "bc:24:11:38:b1:91";
wanLL = "fe80::be24:11ff:feaf:bd84";
lanLL = "fe80::be24:11ff:fe38:b191";
defaultToken = 251;
pdFromWan = "fd46:fbbe:ca55:100";
wanAddr4 = "192.168.1.63";
wanGw4 = "192.168.1.254";
};
networking.hostName = "grouty";
# override hw-vm.nix default
networking.useDHCP = false;
}

View File

@@ -1,24 +0,0 @@
{
imports = [
../hw-vm.nix
];
router = {
enableDesktop = false;
enableDhcpClient = false;
wanMAC = "bc:24:11:bc:db:c1";
lanMAC = "bc:24:11:19:2a:96";
wanLL = "fe80::be24:11ff:febc:dbc1";
lanLL = "fe80::be24:11ff:fe19:2a96";
defaultToken = 252;
pdFromWan = "fd46:fbbe:ca55:100";
wanAddr4 = "192.168.1.64";
wanGw4 = "192.168.1.254";
};
networking.hostName = "grouta";
# override hw-vm.nix default
networking.useDHCP = false;
}

View File

@@ -1,18 +1,16 @@
{
imports = [
../../modules/router
./hardware-configuration.nix
./private.nix
];
router = {
enableDesktop = false;
enableDhcpClient = true;
wanMAC = "bc:24:11:4f:c9:c4";
lanMAC = "bc:24:11:83:d8:de";
wanLL = "fe80::be24:11ff:fe4f:c9c4";
lanLL = "fe80::be24:11ff:fe83:d8de";
defaultToken = 1;
};
networking.hostName = "grouter";
}

View File

@@ -14,7 +14,6 @@ in
./kea.nix
./glance.nix
./services.nix
./keepalived.nix
];
# Secrix for secrets management
secrix.hostPubKey = vars.pubkey;
@@ -31,6 +30,8 @@ in
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12;
boot.growPartition = true;
networking.hostName = "grouter";
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = false;

View File

@@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
let
cfg = config.router;
vars = import ./vars.nix config;
links = vars.links;
ifs = vars.ifs;
@@ -58,7 +57,7 @@ in
# https://github.com/systemd/systemd/issues/22571
# https://github.com/systemd/systemd/issues/22571#issuecomment-2094905496
# https://gist.github.com/csamsel/0f8cca3b2e64d7e4cc47819ec5ba9396
networking.dhcpcd.enable = cfg.enableDhcpClient;
networking.dhcpcd.enable = true;
networking.dhcpcd.allowInterfaces = [ ifs.wan.name ];
networking.dhcpcd.extraConfig = ''
debug

View File

@@ -1,10 +0,0 @@
{ config, lib, pkgs, ... }:
let
vaks = import ./vaks.nix config;
in
{
services.keepalived = {
enable = true;
};
}

View File

@@ -8,36 +8,30 @@ with lib;
enableDesktop = mkOption {
type = types.bool;
default = false;
description = "Enable desktop environment for debugging";
};
enableDhcpClient = mkOption {
type = types.bool;
default = false;
description = "Enable DHCP client (should only be set on the main router)";
description = "Enable desktop environment";
};
wanMAC = mkOption {
type = types.str;
example = "bc:24:11:4f:c9:c4";
default = "bc:24:11:4f:c9:c4";
description = "WAN interface MAC address";
};
lanMAC = mkOption {
type = types.str;
example = "bc:24:11:83:d8:de";
default = "bc:24:11:83:d8:de";
description = "LAN interface MAC address";
};
wanLL = mkOption {
type = types.str;
example = "fe80::be24:11ff:fe4f:c9c4";
default = "fe80::be24:11ff:fe4f:c9c4";
description = "WAN IPv6 link-local address";
};
lanLL = mkOption {
type = types.str;
example = "fe80::be24:11ff:fe83:d8de";
default = "fe80::be24:11ff:fe83:d8de";
description = "LAN IPv6 link-local address";
};
@@ -49,20 +43,17 @@ with lib;
wanAddr4 = mkOption {
type = types.str;
example = "192.168.1.61";
description = "WAN IPv4 address";
};
wanGw4 = mkOption {
type = types.str;
example = "192.168.1.254";
description = "WAN IPv4 gateway";
};
pdFromWan = mkOption {
type = types.str;
example = "2001:db8:0:000";
description = "IPv6 prefix delegation from ISP (/60)";
description = "IPv6 prefix delegation from WAN";
};
};
};

View File

@@ -77,7 +77,7 @@ rec {
p4_ = "${p4}.20"; # .0/24
p6_ = "${pdFromWan}0"; # ::/64 managed by Att box
ulaPrefix_ = "${ulaPrefix}:0020"; # ::/64
ip6Token_ = "::1:${toString cfg.defaultToken}"; # override ipv6 for lan20, since the Att box uses ::1 here
ip6Token_ = "::1:1"; # override ipv6 for lan20, since the Att box uses ::1 here
};
lan30 = mkIfConfig {
name_ = "${lan.name}.30";

View File

@@ -5,7 +5,7 @@
isNormalUser = true;
description = "Yura";
group = "cazzzer";
extraGroups = [ "wheel" "dialout" ]
extraGroups = [ "wheel" ]
++ lib.optionals config.networking.networkmanager.enable [ "networkmanager" ]
++ lib.optionals config.virtualisation.docker.enable [ "docker" ]
++ lib.optionals config.programs.wireshark.enable [ "wireshark" ]