44 lines
800 B
Nix
44 lines
800 B
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.desktop.networking;
|
|
in
|
|
{
|
|
options.my.desktop.networking = {
|
|
enable = lib.mkEnableOption "Enable networking on desktop";
|
|
|
|
hostname = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "The PC hostname";
|
|
default = "desktop-123";
|
|
};
|
|
|
|
localDNS = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
description = "The local DNS resolver (es. PiHole)";
|
|
default = [ "192.168.1.1" ];
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
networking = {
|
|
hostName = cfg.hostname;
|
|
|
|
# Enable networking
|
|
networkmanager = {
|
|
enable = true;
|
|
wifi.powersave = false;
|
|
};
|
|
|
|
nameservers = cfg.localDNS ++ [
|
|
"1.1.1.1"
|
|
"8.8.8.8"
|
|
];
|
|
};
|
|
};
|
|
|
|
}
|