Skip to content

Commit

Permalink
azure-common: Initial garbage-collection config
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <henri.rosten@unikie.com>
  • Loading branch information
henrirosten committed Feb 29, 2024
1 parent abe836b commit 5434721
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion hosts/azure-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
modulesPath,
pkgs,
...
}: {
}: let
asGB = size: toString (size * 1024 * 1024 * 1024);
in {
imports = [
"${modulesPath}/virtualisation/azure-config.nix"
];
Expand All @@ -16,7 +18,20 @@
settings = {
# Enable flakes and 'nix' command
experimental-features = "nix-command flakes";
# When free disk space in /nix/store drops below min-free during build,
# perform a garbage-collection until max-free bytes are available or there
# is no more garbage.
min-free = asGB 10;
max-free = asGB 50;
# check the free disk space every 5 seconds
min-free-check-interval = 5;
};
# Garbage collection
gc.automatic = true;
gc.options = pkgs.lib.mkDefault "--delete-older-than 7d";
};
systemd.services.nix-gc.serviceConfig = {
Restart = "on-failure";
};

# Enable azure agent
Expand Down

0 comments on commit 5434721

Please sign in to comment.