From 1d63a462910fb8070f5081ac8c3f8defd7a84970 Mon Sep 17 00:00:00 2001 From: Aditya Date: Thu, 11 Apr 2024 11:11:14 +0530 Subject: [PATCH] add networking option --- modules/nixos/networking/default.nix | 47 +++++++++++++++++----------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/modules/nixos/networking/default.nix b/modules/nixos/networking/default.nix index 1a53783..49ab34d 100644 --- a/modules/nixos/networking/default.nix +++ b/modules/nixos/networking/default.nix @@ -1,23 +1,32 @@ -_: { - networking = { - hostname = "bridge"; +{ + config, + lib, + ... +}: { + options = { + networking.enable = lib.mkEnableOption "enable networking"; + }; + config = lib.mkIf config.networking.enable { + networking = { + hostname = "bridge"; - networkmanager = { - enable = true; - unmanaged = ["virbr0" "docker0"]; + networkmanager = { + enable = true; + unmanaged = ["virbr0" "docker0"]; + }; + + nftables.enable = true; + + firewall = { + allowedTCPPorts = [80 443]; + trustedInterfaces = ["incusbr0" "virbr0"]; + }; + + extraHosts = '' + 185.199.108.133 raw.githubusercontent.com + ''; + nameservers = ["1.1.1.1" "9.9.9.9"]; + bridges = {incusbr0.interfaces = [];}; }; - - nftables.enable = true; - - firewall = { - allowedTCPPorts = [80 443]; - trustedInterfaces = ["incusbr0" "virbr0"]; - }; - - extraHosts = '' - 185.199.108.133 raw.githubusercontent.com - ''; - nameservers = ["1.1.1.1" "9.9.9.9"]; - bridges = {incusbr0.interfaces = [];}; }; }