Compare commits
2 Commits
84e196cea0
...
0925b5de04
Author | SHA1 | Date | |
---|---|---|---|
0925b5de04 | |||
d1d791f9fb |
11
flake.nix
11
flake.nix
@ -88,6 +88,17 @@
|
|||||||
(hmModule ./home/common.nix)
|
(hmModule ./home/common.nix)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
router-1 = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
secrix.nixosModules.default
|
||||||
|
./modules
|
||||||
|
./hosts/common.nix
|
||||||
|
./hosts/router-1
|
||||||
|
./users/cazzzer
|
||||||
|
(hmModule ./home/common.nix)
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# https://github.com/nix-community/nixos-generators?tab=readme-ov-file#using-in-a-flake
|
# https://github.com/nix-community/nixos-generators?tab=readme-ov-file#using-in-a-flake
|
||||||
packages.x86_64-linux = {
|
packages.x86_64-linux = {
|
||||||
|
23
hosts/router-1/default.nix
Normal file
23
hosts/router-1/default.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../modules/router
|
||||||
|
../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";
|
||||||
|
};
|
||||||
|
|
||||||
|
# override hw-vm.nix default
|
||||||
|
networking.useDHCP = false;
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
router = {
|
router = {
|
||||||
enableDesktop = false;
|
enableDesktop = false;
|
||||||
|
enableDhcpClient = true;
|
||||||
wanMAC = "bc:24:11:4f:c9:c4";
|
wanMAC = "bc:24:11:4f:c9:c4";
|
||||||
lanMAC = "bc:24:11:83:d8:de";
|
lanMAC = "bc:24:11:83:d8:de";
|
||||||
wanLL = "fe80::be24:11ff:fe4f:c9c4";
|
wanLL = "fe80::be24:11ff:fe4f:c9c4";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
cfg = config.router;
|
||||||
vars = import ./vars.nix config;
|
vars = import ./vars.nix config;
|
||||||
links = vars.links;
|
links = vars.links;
|
||||||
ifs = vars.ifs;
|
ifs = vars.ifs;
|
||||||
@ -57,7 +58,7 @@ in
|
|||||||
# https://github.com/systemd/systemd/issues/22571
|
# https://github.com/systemd/systemd/issues/22571
|
||||||
# https://github.com/systemd/systemd/issues/22571#issuecomment-2094905496
|
# https://github.com/systemd/systemd/issues/22571#issuecomment-2094905496
|
||||||
# https://gist.github.com/csamsel/0f8cca3b2e64d7e4cc47819ec5ba9396
|
# https://gist.github.com/csamsel/0f8cca3b2e64d7e4cc47819ec5ba9396
|
||||||
networking.dhcpcd.enable = true;
|
networking.dhcpcd.enable = cfg.enableDhcpClient;
|
||||||
networking.dhcpcd.allowInterfaces = [ ifs.wan.name ];
|
networking.dhcpcd.allowInterfaces = [ ifs.wan.name ];
|
||||||
networking.dhcpcd.extraConfig = ''
|
networking.dhcpcd.extraConfig = ''
|
||||||
debug
|
debug
|
||||||
|
@ -8,30 +8,36 @@ with lib;
|
|||||||
enableDesktop = mkOption {
|
enableDesktop = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Enable desktop environment";
|
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)";
|
||||||
};
|
};
|
||||||
|
|
||||||
wanMAC = mkOption {
|
wanMAC = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "bc:24:11:4f:c9:c4";
|
example = "bc:24:11:4f:c9:c4";
|
||||||
description = "WAN interface MAC address";
|
description = "WAN interface MAC address";
|
||||||
};
|
};
|
||||||
|
|
||||||
lanMAC = mkOption {
|
lanMAC = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "bc:24:11:83:d8:de";
|
example = "bc:24:11:83:d8:de";
|
||||||
description = "LAN interface MAC address";
|
description = "LAN interface MAC address";
|
||||||
};
|
};
|
||||||
|
|
||||||
wanLL = mkOption {
|
wanLL = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "fe80::be24:11ff:fe4f:c9c4";
|
example = "fe80::be24:11ff:fe4f:c9c4";
|
||||||
description = "WAN IPv6 link-local address";
|
description = "WAN IPv6 link-local address";
|
||||||
};
|
};
|
||||||
|
|
||||||
lanLL = mkOption {
|
lanLL = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "fe80::be24:11ff:fe83:d8de";
|
example = "fe80::be24:11ff:fe83:d8de";
|
||||||
description = "LAN IPv6 link-local address";
|
description = "LAN IPv6 link-local address";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,17 +49,20 @@ with lib;
|
|||||||
|
|
||||||
wanAddr4 = mkOption {
|
wanAddr4 = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
example = "192.168.1.61";
|
||||||
description = "WAN IPv4 address";
|
description = "WAN IPv4 address";
|
||||||
};
|
};
|
||||||
|
|
||||||
wanGw4 = mkOption {
|
wanGw4 = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
example = "192.168.1.254";
|
||||||
description = "WAN IPv4 gateway";
|
description = "WAN IPv4 gateway";
|
||||||
};
|
};
|
||||||
|
|
||||||
pdFromWan = mkOption {
|
pdFromWan = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "IPv6 prefix delegation from WAN";
|
example = "2001:db8:0:000";
|
||||||
|
description = "IPv6 prefix delegation from ISP (/60)";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -77,7 +77,7 @@ rec {
|
|||||||
p4_ = "${p4}.20"; # .0/24
|
p4_ = "${p4}.20"; # .0/24
|
||||||
p6_ = "${pdFromWan}0"; # ::/64 managed by Att box
|
p6_ = "${pdFromWan}0"; # ::/64 managed by Att box
|
||||||
ulaPrefix_ = "${ulaPrefix}:0020"; # ::/64
|
ulaPrefix_ = "${ulaPrefix}:0020"; # ::/64
|
||||||
ip6Token_ = "::1:1"; # override ipv6 for lan20, since the Att box uses ::1 here
|
ip6Token_ = "::1:${toString cfg.defaultToken}"; # override ipv6 for lan20, since the Att box uses ::1 here
|
||||||
};
|
};
|
||||||
lan30 = mkIfConfig {
|
lan30 = mkIfConfig {
|
||||||
name_ = "${lan.name}.30";
|
name_ = "${lan.name}.30";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user