nixos,networking: add myFlake.nixos.networking.dns
This commit is contained in:
parent
32019b25d8
commit
b056a38897
3 changed files with 33 additions and 20 deletions
10
flake.nix
10
flake.nix
|
@ -171,7 +171,6 @@
|
|||
./nixos/presets/desktop.nix
|
||||
./nixos/presets/core/zram-generator.nix
|
||||
./nixos/presets/core/boot/no-bootloader-menu.nix
|
||||
./nixos/presets/core/networking/alidns.nix
|
||||
./nixos/presets/desktop/gaming.nix
|
||||
./nixos/presets/desktop/virtualbox.nix
|
||||
./nixos/presets/desktop/wayland.nix
|
||||
|
@ -185,11 +184,14 @@
|
|||
./machines/nixos/81fw-lenovo-legion-y7000/machine-1
|
||||
|
||||
{
|
||||
# extra home-manager stuff
|
||||
home-manager.users.guanranwang = import ./users/guanranwang/home-manager/nixos/presets/desktop/gaming.nix;
|
||||
|
||||
networking.hostName = "81FW-NixOS"; # Hostname
|
||||
time.timeZone = "Asia/Shanghai"; # Timezone
|
||||
|
||||
### Home-Manager
|
||||
home-manager.users.guanranwang = import ./users/guanranwang/home-manager/nixos/presets/desktop/gaming.nix;
|
||||
|
||||
### Options
|
||||
myFlake.nixos.networking.dns = "alidns";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,9 +1,29 @@
|
|||
{...}: {
|
||||
networking.nameservers = [
|
||||
### Google DNS
|
||||
"8.8.8.8"
|
||||
"8.8.4.4"
|
||||
"2001:4860:4860::8888"
|
||||
"2001:4860:4860::8844"
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
options.myFlake.nixos.networking.dns = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = "google";
|
||||
example = "alidns";
|
||||
description = "Select your DNS provider";
|
||||
};
|
||||
|
||||
config.networking.nameservers = lib.mkMerge [
|
||||
(lib.mkIf (config.myFlake.nixos.networking.dns == "google") [
|
||||
### Google DNS
|
||||
"8.8.8.8"
|
||||
"8.8.4.4"
|
||||
"2001:4860:4860::8888"
|
||||
"2001:4860:4860::8844"
|
||||
])
|
||||
(lib.mkIf (config.myFlake.nixos.networking.dns == "alidns") [
|
||||
### AliDNS
|
||||
"223.5.5.5"
|
||||
"223.6.6.6"
|
||||
"2400:3200::1"
|
||||
"2400:3200:baba::1"
|
||||
])
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{lib, ...}: {
|
||||
networking.nameservers = lib.mkForce [
|
||||
### AliDNS
|
||||
"223.5.5.5"
|
||||
"223.6.6.6"
|
||||
"2400:3200::1"
|
||||
"2400:3200:baba::1"
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue