mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-26 18:08:28 +02:00
fix: nixConfig.extra-sbustituers https://github.com/ryan4yin/nixos-and-flakes-book/discussions/62#discussioncomment-7805510
This commit is contained in:
19
flake.nix
19
flake.nix
@@ -409,30 +409,17 @@
|
|||||||
|
|
||||||
# the nixConfig here only affects the flake itself, not the system configuration!
|
# the nixConfig here only affects the flake itself, not the system configuration!
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
substituters = [
|
# substituers will be appended to the default substituters when fetching packages
|
||||||
# cache mirror located in China
|
extra-substituters = [
|
||||||
# status: https://mirror.sjtu.edu.cn/
|
# my own cache server
|
||||||
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
|
||||||
# status: https://mirrors.ustc.edu.cn/status/
|
|
||||||
# "https://mirrors.ustc.edu.cn/nix-channels/store"
|
|
||||||
|
|
||||||
# fallback to official cache server if the above mirrors are not available
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
|
|
||||||
# fallback to other non-official cache server
|
|
||||||
"https://ryan4yin.cachix.org"
|
"https://ryan4yin.cachix.org"
|
||||||
"https://anyrun.cachix.org"
|
"https://anyrun.cachix.org"
|
||||||
"https://hyprland.cachix.org"
|
"https://hyprland.cachix.org"
|
||||||
];
|
|
||||||
|
|
||||||
# nix community's cache server
|
|
||||||
extra-substituters = [
|
|
||||||
"https://nix-community.cachix.org"
|
"https://nix-community.cachix.org"
|
||||||
"https://nixpkgs-wayland.cachix.org"
|
"https://nixpkgs-wayland.cachix.org"
|
||||||
];
|
];
|
||||||
extra-trusted-public-keys = [
|
extra-trusted-public-keys = [
|
||||||
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
|
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
}: {
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# creative
|
# creative
|
||||||
# blender # 3d modeling
|
blender # 3d modeling
|
||||||
# gimp # image editing, I prefer using figma in browser instead of this one
|
# gimp # image editing, I prefer using figma in browser instead of this one
|
||||||
inkscape # vector graphics
|
inkscape # vector graphics
|
||||||
krita # digital painting
|
krita # digital painting
|
||||||
|
|||||||
@@ -29,6 +29,4 @@ in {
|
|||||||
# DO NOT change the system's default shell to nushell! it will break some apps!
|
# DO NOT change the system's default shell to nushell! it will break some apps!
|
||||||
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.trusted-users = [username];
|
|
||||||
}
|
}
|
||||||
|
|||||||
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 = [
|
imports = [
|
||||||
./apps.nix
|
../common.nix
|
||||||
./nix-core.nix
|
./nix-core.nix
|
||||||
|
|
||||||
|
./apps.nix
|
||||||
./system.nix
|
./system.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
#
|
#
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
# enable flakes globally
|
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
|
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
@@ -28,13 +25,6 @@
|
|||||||
|
|
||||||
programs.nix-index.enable = true;
|
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:
|
# Disable auto-optimise-store because of this issue:
|
||||||
# https://github.com/NixOS/nix/issues/7273
|
# https://github.com/NixOS/nix/issues/7273
|
||||||
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
|
# "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
|
# for nix server, we do not need to keep too much generations
|
||||||
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
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.
|
# Set your time zone.
|
||||||
time.timeZone = "Asia/Shanghai";
|
time.timeZone = "Asia/Shanghai";
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
{ username, ... }:
|
{ username, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
nix.settings.trusted-users = [username];
|
|
||||||
|
|
||||||
# Don't allow mutation of users outside the config.
|
# Don't allow mutation of users outside the config.
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user