Skip to content

Commit

Permalink
✨ Inserted nameservers via networkmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Jan 10, 2025
1 parent 2951bd0 commit 5debd96
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions modules/nixos/hardware/networking/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,47 @@
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt enabled;
inherit (lib) mkIf types;
inherit (lib.${namespace}) mkBoolOpt mkOpt;

cfg = config.${namespace}.hardware.networking;
in
{
options.${namespace}.hardware.networking = {
options.${namespace}.hardware.networking = with types; {
enable = mkBoolOpt false "Enable networkmanager.";
insertNameservers = mkOpt (listOf str) [
# Cloudflare
"1.1.1.1"
"1.0.0.1"
# Google
"8.8.8.8"
"8.8.4.4"
] "Insert nameservers before the ones added by networkmanager";
};

config = mkIf cfg.enable {
networking.firewall = {
enable = true;
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
};
networking = {
networkmanager = {
enable = true;

inherit (cfg) insertNameservers;
};

networking.networkmanager = enabled;
firewall = {
enable = true;
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
};
};
};
}

0 comments on commit 5debd96

Please sign in to comment.