diff --git a/darwin/profiles/core/nix/nix.nix b/darwin/profiles/core/nix/nix.nix index 8d6881a..a200fe5 100755 --- a/darwin/profiles/core/nix/nix.nix +++ b/darwin/profiles/core/nix/nix.nix @@ -1,24 +1,23 @@ { pkgs, - lib, config, ... }: { nix.settings = { trusted-users = ["@admin"]; substituters = - lib.mkMerge - [ - (lib.mkIf (config.time.timeZone == "Asia/Shanghai") [ + { + "Asia/Shanghai" = [ "https://mirrors.ustc.edu.cn/nix-channels/store" # USTC - 中国科学技术大学 Mirror "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror "https://mirrors.bfsu.edu.cn/nix-channels/store" # BFSU - 北京外国语大学 Mirror "https://mirror.sjtu.edu.cn/nix-channels/store" # SJTU - 上海交通大学 Mirror - ]) - [ - "https://nix-community.cachix.org" - "https://cache.garnix.io" - ] + ]; + } + .${config.time.timeZone} + ++ [ + "https://nix-community.cachix.org" + "https://cache.garnix.io" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" diff --git a/nixos/modules/networking/dns.nix b/nixos/modules/networking/dns.nix index 466888d..bdcff6c 100644 --- a/nixos/modules/networking/dns.nix +++ b/nixos/modules/networking/dns.nix @@ -17,21 +17,23 @@ in { }; config = { - networking.nameservers = lib.mkMerge [ - (lib.mkIf (cfg.provider == "google") [ - ### Google DNS - "8.8.8.8" - "8.8.4.4" - "2001:4860:4860::8888" - "2001:4860:4860::8844" - ]) - (lib.mkIf (cfg.provider == "alidns") [ - ### AliDNS - "223.5.5.5" - "223.6.6.6" - "2400:3200::1" - "2400:3200:baba::1" - ]) - ]; + networking.nameservers = + { + google = [ + ### Google DNS + "8.8.8.8" + "8.8.4.4" + "2001:4860:4860::8888" + "2001:4860:4860::8844" + ]; + alidns = [ + ### AliDNS + "223.5.5.5" + "223.6.6.6" + "2400:3200::1" + "2400:3200:baba::1" + ]; + } + .${cfg.provider}; }; } diff --git a/nixos/profiles/core/nix/nix.nix b/nixos/profiles/core/nix/nix.nix index 16bd75d..37eb401 100755 --- a/nixos/profiles/core/nix/nix.nix +++ b/nixos/profiles/core/nix/nix.nix @@ -1,23 +1,19 @@ -{ - lib, - config, - ... -}: { +{config, ...}: { nix.settings = { trusted-users = ["@wheel"]; substituters = - lib.mkMerge - [ - (lib.mkIf (config.time.timeZone == "Asia/Shanghai") [ + { + "Asia/Shanghai" = [ "https://mirrors.ustc.edu.cn/nix-channels/store" # USTC - 中国科学技术大学 Mirror "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror "https://mirrors.bfsu.edu.cn/nix-channels/store" # BFSU - 北京外国语大学 Mirror "https://mirror.sjtu.edu.cn/nix-channels/store" # SJTU - 上海交通大学 Mirror - ]) - [ - "https://nix-community.cachix.org" - "https://cache.garnix.io" - ] + ]; + } + .${config.time.timeZone} + ++ [ + "https://nix-community.cachix.org" + "https://cache.garnix.io" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" @@ -33,13 +29,6 @@ }; system = { - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - - # Does not work with flake based configurations - copySystemConfiguration = lib.mkDefault true; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave diff --git a/users/guanranwang/home-manager/applications/starship/default.nix b/users/guanranwang/home-manager/applications/starship/default.nix index 8dd012c..75ac05d 100644 --- a/users/guanranwang/home-manager/applications/starship/default.nix +++ b/users/guanranwang/home-manager/applications/starship/default.nix @@ -1,11 +1,7 @@ -{ - lib, - pkgs, - ... -}: { +{pkgs, ...}: { programs.starship = { enable = true; - settings = lib.mkMerge [ + settings = { add_newline = false; line_break.disabled = true; @@ -19,7 +15,6 @@ vimcmd_visual_symbol = "[<](bold yellow)"; }; } - (builtins.fromTOML (builtins.readFile "${pkgs.starship}/share/starship/presets/nerd-font-symbols.toml")) - ]; + // (builtins.fromTOML (builtins.readFile "${pkgs.starship}/share/starship/presets/nerd-font-symbols.toml")); }; }