nixos: modules: dns: set default dns by timezone

This commit is contained in:
Guanran Wang 2023-12-10 18:09:44 +08:00
parent ba214509cb
commit 6ce0c41baf
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
2 changed files with 6 additions and 3 deletions

View file

@ -9,7 +9,12 @@ in {
myFlake.nixos.networking.dns = { myFlake.nixos.networking.dns = {
provider = lib.mkOption { provider = lib.mkOption {
type = lib.types.enum ["google" "alidns"]; type = lib.types.enum ["google" "alidns"];
default = "google"; default =
{
"Asia/Shanghai" = "alidns";
}
.${config.time.timeZone}
or "google";
example = "alidns"; example = "alidns";
description = "Select desired DNS provider."; description = "Select desired DNS provider.";
}; };

View file

@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
config, config,
lib,
... ...
}: { }: {
users.users."guanranwang" = { users.users."guanranwang" = {
@ -21,7 +20,6 @@
}; };
programs.fish.enable = true; programs.fish.enable = true;
myFlake.nixos.networking.dns.provider = lib.mkDefault "alidns";
users.groups."nix-access-tokens" = {}; users.groups."nix-access-tokens" = {};
nix.extraOptions = "!include ${config.sops.secrets.nix-access-tokens.path}"; nix.extraOptions = "!include ${config.sops.secrets.nix-access-tokens.path}";