blob: fde9399baaf801a91137fb427812207a0eecce84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
{ config, lib, ... }:
let
cfg = config.os.core.storage;
in
{
options.os.core.storage = {
enable = lib.mkEnableOption "enables storage management";
cleanDates = lib.mkOption {
type = lib.types.str;
default = "weekly";
description = "how often to clean the system of old generations";
};
};
config = lib.mkIf cfg.enable {
nix.settings.auto-optimise-store = true;
programs.nh = {
enable = true;
clean = {
enable = true;
dates = "${toString cfg.cleanDates}";
extraArgs = "--keep 5";
};
};
services.fstrim.enable = true;
services.btrfs.autoScrub = {
enable = true;
fileSystems = [ "/" ];
};
boot.tmp = {
useTmpfs = true;
tmpfsSize = "50%";
};
};
}
|