Extract auto-gc into it's own module

This commit is contained in:
SebastianStork 2024-06-09 23:58:23 +02:00
parent 2442658380
commit b020faa8d2
5 changed files with 18 additions and 20 deletions

View file

@ -27,10 +27,8 @@
sops.enable = true;
printing.enable = true;
syncthing.enable = true;
nix-helper = {
enable = true;
nix-helper.enable = true;
auto-gc.enable = true;
};
night-light.enable = true;
};

View file

@ -23,10 +23,8 @@
sops.enable = true;
printing.enable = true;
syncthing.enable = true;
nix-helper = {
enable = true;
nix-helper.enable = true;
auto-gc.enable = true;
};
night-light.enable = true;
};

View file

@ -0,0 +1,13 @@
{ config, lib, ... }:
{
options.myConfig.auto-gc.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.auto-gc.enable {
programs.nh.enable = true;
programs.nh.clean = {
enable = true;
dates = "daily";
extraArgs = "--keep 10 --keep-since 3d";
};
};
}

View file

@ -14,6 +14,7 @@
./printing.nix
./syncthing.nix
./nix-helper.nix
./auto-gc.nix
./night-light.nix
];
}

View file

@ -1,14 +1,8 @@
{ config, lib, ... }:
let
cfg = config.myConfig.nix-helper;
in
{
options.myConfig.nix-helper = {
enable = lib.mkEnableOption "";
auto-gc.enable = lib.mkEnableOption "";
};
options.myConfig.nix-helper.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.myConfig.nix-helper.enable {
environment.sessionVariables.FLAKE = "/home/seb/Projects/nixos/my-config";
programs.nh.enable = true;
@ -22,11 +16,5 @@ in
nrb = "${rebuild} boot";
nrrb = "nrb && reboot";
};
programs.nh.clean = lib.mkIf cfg.auto-gc.enable {
enable = true;
dates = "daily";
extraArgs = "--keep 10 --keep-since 3d";
};
};
}