backwards: Automatically garbage collect generations
This commit is contained in:
@@ -1,12 +1,38 @@
|
|||||||
{ ... }:
|
{ inputs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
configurationLimit = config.mod.gc.configurationLimit;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
boot = {
|
imports = [ inputs.nix-gc-env.nixosModules.default ];
|
||||||
loader = {
|
|
||||||
systemd-boot = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
efi.canTouchEfiVariables = true;
|
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 = {
|
||||||
|
systemd-boot = {
|
||||||
|
enable = true;
|
||||||
|
inherit configurationLimit;
|
||||||
|
};
|
||||||
|
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ in
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
mod = {
|
mod = {
|
||||||
|
gc.configurationLimit = 10;
|
||||||
|
|
||||||
ssh.enable = true;
|
ssh.enable = true;
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user