hosts: add nix-cache module

This commit is contained in:
2026-05-16 23:48:31 +08:00
parent 92ecc0cccc
commit 3af3076a86
3 changed files with 31 additions and 10 deletions
+2 -5
View File
@@ -10,10 +10,9 @@
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
../modules/nix-cache.nix
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
boot.loader = { boot.loader = {
efi = { efi = {
canTouchEfiVariables = true; canTouchEfiVariables = true;
@@ -32,10 +31,8 @@
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
nix.settings = { nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
trusted-users = [ "origami" ]; trusted-users = [ "origami" ];
substituters = [
"https://mirrors.ustc.edu.cn/nix-channels/store"
];
auto-optimise-store = true; auto-optimise-store = true;
}; };
+27
View File
@@ -0,0 +1,27 @@
{ inputs, lib, pkgs, ... }:
{
nix.settings = {
substituters =
let
channelStore = x: "https://${x}/nix-channels/store";
mirrors = map (x: channelStore "mirrors.${x}.edu.cn") [
"bfsu"
"tuna.tsinghua"
"ustc"
];
cachix = x: "https://${x}.cachix.org";
in
lib.flatten [
mirrors
(cachix "nix-community")
"https://cache.nixos.org"
(cachix "inclyc")
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"inclyc.cachix.org-1:izGZ+f/JLPovKX1OKd3rQZ8nPOCpvPij3+bebjxdZ2k="
];
builders-use-substitutes = true;
};
}
+2 -5
View File
@@ -5,10 +5,9 @@
[ [
./hardware-configuration.nix ./hardware-configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
../modules/nix-cache.nix
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# BIOS + GRUB, 安装到 MBR # BIOS + GRUB, 安装到 MBR
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;
@@ -29,10 +28,8 @@
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
nix.settings = { nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
trusted-users = [ "origami" ]; trusted-users = [ "origami" ];
substituters = [
"https://mirrors.bfsu.edu.cn/nix-channels/store"
];
auto-optimise-store = true; auto-optimise-store = true;
}; };