Ryan Yin
2023-12-09 14:18:19 +08:00
parent ec1747707b
commit c170e251ac
8 changed files with 51 additions and 51 deletions

View File

@@ -409,30 +409,17 @@
# the nixConfig here only affects the flake itself, not the system configuration!
nixConfig = {
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"
# fallback to official cache server if the above mirrors are not available
"https://cache.nixos.org"
# fallback to other non-official cache server
# substituers will be appended to the default substituters when fetching packages
extra-substituters = [
# my own cache server
"https://ryan4yin.cachix.org"
"https://anyrun.cachix.org"
"https://hyprland.cachix.org"
];
# nix community's cache server
extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
];
extra-trusted-public-keys = [
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="

View File

@@ -6,7 +6,7 @@
}: {
home.packages = with pkgs; [
# creative
# blender # 3d modeling
blender # 3d modeling
# gimp # image editing, I prefer using figma in browser instead of this one
inkscape # vector graphics
krita # digital painting

View File

@@ -29,6 +29,4 @@ in {
# 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!
};
nix.settings.trusted-users = [username];
}

40
modules/common.nix Normal file
View 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;
}

View File

@@ -1,7 +1,9 @@
{
imports = [
./apps.nix
../common.nix
./nix-core.nix
./apps.nix
./system.nix
];
}

View File

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

View File

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

View File

@@ -1,8 +1,6 @@
{ username, ... }:
{
nix.settings.trusted-users = [username];
# Don't allow mutation of users outside the config.
users.mutableUsers = false;