✨ make use of mkEnableOption
This commit is contained in:
parent
a98589b6f8
commit
5c0752b891
43 changed files with 73 additions and 329 deletions
|
|
@ -11,22 +11,21 @@ let
|
|||
in
|
||||
{
|
||||
options.my.nix = {
|
||||
gc.enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
example = false;
|
||||
};
|
||||
optimise.enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
example = false;
|
||||
gc = {
|
||||
enable = mkEnableOption "nix-gc";
|
||||
minimumFreedGB = mkOption {
|
||||
default = 32;
|
||||
type = types.int;
|
||||
apply = number: toString (number * 1024 * 1024 * 1024);
|
||||
};
|
||||
};
|
||||
optimise.enable = mkEnableOption "nix-optimise";
|
||||
};
|
||||
|
||||
config.nix = {
|
||||
gc = {
|
||||
automatic = cfg.gc.enable;
|
||||
options = "--max-freed $((32 * 1024**3)) --delete-older-than 14d";
|
||||
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
|
||||
dates = "weekly";
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue