treewide: simplify

This commit is contained in:
Guanran Wang 2023-12-03 16:16:41 +08:00
parent 91dfa05ef9
commit 887c187cb0
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
4 changed files with 38 additions and 53 deletions

View file

@ -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="

View file

@ -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};
};
}

View file

@ -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

View file

@ -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"));
};
}