44 lines
756 B
Nix
44 lines
756 B
Nix
{
|
|
inputs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
let
|
|
configurationLimit = config.mod.gc.configurationLimit;
|
|
in
|
|
{
|
|
imports = [ inputs.nix-gc-env.nixosModules.default ];
|
|
|
|
options = {
|
|
mod.gc = {
|
|
configurationLimit = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 10;
|
|
description = "number of configuration generations to keep";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
nix.gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
|
|
# `delete_generations` added by nix-gc-env
|
|
delete_generations = "+${builtins.toString configurationLimit}";
|
|
};
|
|
|
|
boot = {
|
|
loader = {
|
|
grub = {
|
|
enable = true;
|
|
device = "/dev/sda";
|
|
|
|
inherit configurationLimit;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|