nixowos/defaults/nix.nix

35 lines
958 B
Nix

{
pkgs,
lib,
config,
...
}:
let
name = "nix";
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.defaults.${name} = {
enable = lib.mkEnableOption name;
};
config = lib.mkIf cfg.enable {
# enable useful nix tools, and the flakes system
nix.settings.experimental-features = "nix-command flakes";
# you (should) never need this
nix.channel.enable = false;
# reduces disk usage of the nix store
# It does this by performing `nix store optimize` incrementally for each new path
# source: https://nix.dev/manual/nix/2.26/command-ref/new-cli/nix3-store-optimise
nix.settings.auto-optimise-store = true;
# trigger the garbage collector automatically
# when free space in /nix/store goes below this
nix.settings.min-free = 1000000000; # 1GB
# free up to this many bytes in an automatic invocation
# to avoid it taking too long
nix.settings.max-free = 5000000000; # 5GB
};
}