# Power user optimizations and better defaults for NixOS { config, pkgs, lib, ... }: { # Enable flakes and new nix command by default nix = { settings = { # Enable flakes and new nix command experimental-features = [ "nix-command" "flakes" ]; # Optimize builds auto-optimise-store = true; max-jobs = "auto"; cores = 0; # Use all available cores # Better substituters for faster downloads substituters = [ "https://cache.nixos.org/" "https://nix-community.cachix.org" "https://cache.garnix.io" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbCWZKkK1YDH9c6MCSM=" ]; # Optimize networking http-connections = 128; max-substitution-jobs = 128; # Better compression compress-build-log = true; # Security require-sigs = true; # Keep build dependencies for debugging keep-derivations = true; keep-outputs = true; # Better sandbox sandbox = true; # Trusted users for nix daemon trusted-users = [ "root" "@wheel" ]; }; # Automatic garbage collection gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 7d"; }; # Optimize store automatically optimise = { automatic = true; dates = [ "03:45" ]; }; # Nix registry for flakes registry = { nixpkgs.flake = lib.mkDefault { type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "nixos-unstable"; }; }; # Nix path for backwards compatibility nixPath = [ "nixpkgs=flake:nixpkgs" ]; }; }