mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-29 22:01:58 +02:00
fix: nixConfig.extra-sbustituers https://github.com/ryan4yin/nixos-and-flakes-book/discussions/62#discussioncomment-7805510
This commit is contained in:
40
modules/common.nix
Normal file
40
modules/common.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
lib,
|
||||
username,
|
||||
...
|
||||
}: {
|
||||
nix.settings = {
|
||||
# enable flakes globally
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
# given the users in this list the right to specify additional substituters via:
|
||||
# 1. `nixConfig.substituers` in `flake.nix`
|
||||
# 2. command line args `--options substituers http://xxx`
|
||||
trusted-users = [username];
|
||||
|
||||
substituters = [
|
||||
# cache mirror located in China
|
||||
# status: https://mirror.sjtu.edu.cn/
|
||||
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
||||
# status: https://mirrors.ustc.edu.cn/status/
|
||||
# "https://mirrors.ustc.edu.cn/nix-channels/store"
|
||||
|
||||
"https://cache.nixos.org"
|
||||
];
|
||||
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
];
|
||||
builders-use-substitutes = true;
|
||||
};
|
||||
|
||||
# do garbage collection weekly to keep disk usage low
|
||||
nix.gc = {
|
||||
automatic = lib.mkDefault true;
|
||||
dates = lib.mkDefault "weekly";
|
||||
options = lib.mkDefault "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = lib.mkDefault false;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
imports = [
|
||||
./apps.nix
|
||||
../common.nix
|
||||
./nix-core.nix
|
||||
|
||||
./apps.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#
|
||||
###################################################################################
|
||||
|
||||
# enable flakes globally
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@@ -28,13 +25,6 @@
|
||||
|
||||
programs.nix-index.enable = true;
|
||||
|
||||
# boot.loader.grub.configurationLimit = 10;
|
||||
# do garbage collection weekly to keep disk usage low
|
||||
nix.gc = {
|
||||
automatic = lib.mkDefault true;
|
||||
options = lib.mkDefault "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# Disable auto-optimise-store because of this issue:
|
||||
# https://github.com/NixOS/nix/issues/7273
|
||||
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
|
||||
|
||||
@@ -9,27 +9,12 @@
|
||||
#
|
||||
###################################################################################
|
||||
|
||||
imports = [
|
||||
../common.nix
|
||||
];
|
||||
|
||||
# for nix server, we do not need to keep too much generations
|
||||
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
||||
# boot.loader.grub.configurationLimit = 10;
|
||||
# do garbage collection weekly to keep disk usage low
|
||||
nix.gc = {
|
||||
automatic = lib.mkDefault true;
|
||||
dates = lib.mkDefault "weekly";
|
||||
options = lib.mkDefault "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
nix.settings = {
|
||||
# Manual optimise storage: nix-store --optimise
|
||||
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
|
||||
auto-optimise-store = true;
|
||||
builders-use-substitutes = true;
|
||||
# enable flakes globally
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = lib.mkDefault false;
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
{ username, ... }:
|
||||
|
||||
{
|
||||
nix.settings.trusted-users = [username];
|
||||
|
||||
# Don't allow mutation of users outside the config.
|
||||
users.mutableUsers = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user