flake/nixos/profiles/core/nix.nix

61 lines
1.5 KiB
Nix
Raw Normal View History

2024-07-09 21:45:51 +00:00
{
lib,
config,
2024-07-09 23:18:57 +00:00
inputs,
2024-07-09 21:45:51 +00:00
...
}: {
2023-09-19 00:17:43 +00:00
nix.settings = {
2023-11-27 12:33:27 +00:00
substituters =
2024-07-09 21:45:51 +00:00
(lib.optionals (config.time.timeZone == "Asia/Shanghai") [
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror
])
2023-12-03 08:16:41 +00:00
++ [
"https://nix-community.cachix.org"
"https://guanran928.cachix.org"
2023-11-27 12:33:27 +00:00
];
2023-09-19 00:17:43 +00:00
trusted-public-keys = [
2023-09-26 23:40:21 +00:00
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"guanran928.cachix.org-1:BE/iBCj2/pqJXG908wHRrcaV0B2fC+KbFjHsXY6b91c="
2023-09-19 00:17:43 +00:00
];
2024-01-24 18:06:42 +00:00
2024-07-07 13:40:43 +00:00
experimental-features = [
"auto-allocate-uids"
"cgroups"
2024-07-09 23:18:57 +00:00
"flakes"
"nix-command"
2024-07-07 13:40:43 +00:00
"no-url-literals"
];
2024-07-09 23:18:57 +00:00
flake-registry = "";
2024-08-23 08:10:31 +00:00
trusted-users = ["@wheel"];
2024-07-07 13:40:43 +00:00
allow-import-from-derivation = false;
2024-01-24 18:06:42 +00:00
auto-allocate-uids = true;
2024-07-09 23:18:57 +00:00
auto-optimise-store = true;
2024-01-24 18:06:42 +00:00
builders-use-substitutes = true;
use-cgroups = true;
2023-09-19 00:17:43 +00:00
use-xdg-base-directories = true;
};
2024-07-09 23:18:57 +00:00
nix = {
# Add each flake input as a registry
# To make nix3 commands consistent with the flake
registry = lib.mapAttrs (_: value: {flake = value;}) inputs;
# Disable nix-channel
channel.enable = false;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
extraOptions = "!include ${config.sops.secrets.nix-access-tokens.path}";
2023-09-19 00:17:43 +00:00
};
2024-06-05 09:51:12 +00:00
2024-07-09 23:18:57 +00:00
users.groups."nix-access-tokens" = {};
sops.secrets."nix-access-tokens" = {
group = config.users.groups."nix-access-tokens".name;
mode = "0440";
2024-06-05 09:51:12 +00:00
};
2023-09-19 00:17:43 +00:00
}