nixos-config-priv/systems/common/core/nix.nix

62 lines
1.6 KiB
Nix

{
inputs,
lib,
pkgs,
...
}: {
nix = {
# https://github.com/NixOS/nix/issues/9579
# https://github.com/NixOS/nix/pull/9547
package = pkgs.inputs.nix.nix;
# Add each flake input as a registry
# To make nix3 commands consistent with the flake
registry = lib.mapAttrs (_: value: {flake = value;}) inputs;
# This will 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 = {
substituters = lib.mkAfter ["https://cache.great-hyperlobic-omnicognate-neutron-wrangler.space"];
trusted-public-keys = ["cache.great-hyperlobic-omnicognate-neutron-wrangler.space:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg="]; #TODO: Setup cache and change this
trusted-users = [
"root"
"@wheel"
];
# Deduplicate and optimize nix store
auto-optimise-store = lib.mkDefault true;
experimental-features = [
"nix-command"
"flakes"
"repl-flake"
"ca-derivations"
];
# See https://jackson.dev/post/nix-reasonable-defaults/
connect-timeout = 5;
log-lines = 25;
min-free = 128000000; # 128MB
max-free = 1000000000; # 1GB
warn-dirty = false;
system-features = [
"kvm"
"big-parallel"
"nixos-test"
];
flake-registry = ""; # Disable global flake registry
};
# garbage collection
gc = {
automatic = true;
dates = "weekly";
# Keep the last 3 generations
options = "--delete-older-than +3";
};
};
}