infra/modules/shared/builder.nix
2024-07-24 10:27:26 +00:00

17 lines
398 B
Nix

{
config,
lib,
pkgs,
...
}:
{
options.nixCommunity.gc.gbFree = lib.mkOption {
type = lib.types.int;
default = 150;
description = "Amount of free space in GB to keep on disk.";
};
config.nix.gc.options = ''
--max-freed "$((${toString config.nixCommunity.gc.gbFree} * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | ${pkgs.gawk}/bin/awk '{ print $4 }')))"
'';
}