restructured and optimized content

This commit is contained in:
2025-04-21 14:21:37 +08:00
parent e1d5d900fb
commit 4af72b9d39
28 changed files with 632 additions and 609 deletions

View File

@@ -0,0 +1,91 @@
{ inputs, outputs, config, lib, ... }:
{
security = {
sudo.enable = true;
polkit.enable = true;
};
services = {
printing.enable = true;
acpid.enable = true;
upower.enable = true;
};
nix = {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
substituters = [
"https://mirrors.ustc.edu.cn/nix-channels/store"
"https://nixos-cn.cachix.org"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
trusted-public-keys = [
"nixos-cn.cachix.org-1:L0jEaL6w7kwQOPlLoCR3ADx+E3Q8SEFEcB9Jaibl0Xg="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
trusted-users = [ "root" ];
# Enable local binary cache
keep-outputs = true;
keep-derivations = true;
max-jobs = "auto";
cores = 0; # Use all available cores
# Deduplicate and optimize nix store during build
# auto-optimise-store = true;
};
gc = {
automatic = true; # Enable automatic garbage collection
dates = "weekly"; # Execute garbage collection weekly
persistent = true; # Keep settings after reboot
randomizedDelaySec = "15min"; # Add up to 15 minutes of random delay
options = "--delete-older-than 30d"; # Delete files older than 30 days
};
# Automatically run garbage collection whenever there is not enough space left
# Free up to 5GiB whenever there is less than 1GiB left:
extraOptions = ''
min-free = ${toString (1 * 1024 * 1024 * 1024)}
max-free = ${toString (5 * 1024 * 1024 * 1024)}
'';
};
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
}