diff --git a/flake.nix b/flake.nix index bfba84f..7f79b5c 100644 --- a/flake.nix +++ b/flake.nix @@ -88,6 +88,17 @@ (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 packages.x86_64-linux = { diff --git a/hosts/router-1/default.nix b/hosts/router-1/default.nix new file mode 100644 index 0000000..dd16422 --- /dev/null +++ b/hosts/router-1/default.nix @@ -0,0 +1,25 @@ +{ + 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"; + }; + + networking.hostName = "grouty"; + + # override hw-vm.nix default + networking.useDHCP = false; +} diff --git a/hosts/router/default.nix b/hosts/router/default.nix index e3cb04b..7b0423b 100644 --- a/hosts/router/default.nix +++ b/hosts/router/default.nix @@ -7,6 +7,7 @@ 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"; diff --git a/modules/router/ifconfig.nix b/modules/router/ifconfig.nix index 8351950..aa227b0 100644 --- a/modules/router/ifconfig.nix +++ b/modules/router/ifconfig.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: let + cfg = config.router; vars = import ./vars.nix config; links = vars.links; ifs = vars.ifs; @@ -57,7 +58,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 = true; + networking.dhcpcd.enable = cfg.enableDhcpClient; networking.dhcpcd.allowInterfaces = [ ifs.wan.name ]; networking.dhcpcd.extraConfig = '' debug diff --git a/modules/router/opts.nix b/modules/router/opts.nix index c32de7b..d9a39bf 100644 --- a/modules/router/opts.nix +++ b/modules/router/opts.nix @@ -8,7 +8,13 @@ with lib; enableDesktop = mkOption { type = types.bool; 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 {