2024-02-12 18:08:41 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
{
|
2025-02-09 21:05:15 +01:00
|
|
|
# Garbage collection: Delete generations older than 5 days and then delete unreachable store objects.
|
2024-11-11 11:48:49 +01:00
|
|
|
|
2024-08-23 14:38:42 +02:00
|
|
|
# https://nixos.wiki/wiki/Storage_optimization#Automation
|
2025-02-09 21:05:15 +01:00
|
|
|
# https://nixos.wiki/wiki/Storage_optimization#Removing_old_generations
|
|
|
|
nix.gc = {
|
|
|
|
automatic = true;
|
|
|
|
dates = "weekly";
|
|
|
|
options = "--delete-older-than 5d";
|
|
|
|
};
|
2024-02-12 18:08:41 +01:00
|
|
|
|
2025-02-09 21:05:15 +01:00
|
|
|
# We need to explicitly run garbage collection for user profiles,
|
|
|
|
# this is not done by the global `nix.gc` option.
|
|
|
|
home-manager.users."yoda" = { osConfig, config, pkgs, ... }: {
|
|
|
|
nix.gc = {
|
|
|
|
automatic = true;
|
|
|
|
frequency = "weekly";
|
|
|
|
options = "--delete-older-than 5d";
|
2024-02-12 18:08:41 +01:00
|
|
|
};
|
|
|
|
};
|
2025-02-09 21:05:15 +01:00
|
|
|
home-manager.users."root" = { osConfig, config, pkgs, ... }: {
|
|
|
|
nix.gc = {
|
|
|
|
automatic = true;
|
|
|
|
frequency = "weekly";
|
|
|
|
options = "--delete-older-than 5d";
|
2024-02-12 18:08:41 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|