mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
services.snapper: fix
This commit is contained in:
@@ -5,33 +5,25 @@ inputs:
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
configs = mkOption { type = types.attrsOf types.nonEmptyStr; default.persistent = "/nix/persistent"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.lib) mkMerge mkIf;
|
||||
inherit (inputs.localLib) stripeTabs attrsToList;
|
||||
inherit (inputs.config.nixos) services;
|
||||
inherit (builtins) map listToAttrs toString;
|
||||
in mkIf services.snapper.enable
|
||||
{
|
||||
services.snapper.configs =
|
||||
let
|
||||
f = (config:
|
||||
{
|
||||
inherit (config) name;
|
||||
value =
|
||||
{
|
||||
SUBVOLUME = config.value;
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_MIN_AGE = 1800;
|
||||
TIMELINE_LIMIT_HOURLY = "10";
|
||||
TIMELINE_LIMIT_DAILY = "7";
|
||||
TIMELINE_LIMIT_WEEKLY = "1";
|
||||
TIMELINE_LIMIT_MONTHLY = "0";
|
||||
TIMELINE_LIMIT_YEARLY = "0";
|
||||
};
|
||||
});
|
||||
in
|
||||
listToAttrs (map f (attrsToList services.snapper.configs));
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.services) snapper; in inputs.lib.mkIf snapper.enable
|
||||
{
|
||||
services.snapper.configs = builtins.listToAttrs (builtins.map
|
||||
(config:
|
||||
{
|
||||
inherit (config) name;
|
||||
value =
|
||||
{
|
||||
SUBVOLUME = config.value;
|
||||
TIMELINE_CREATE = true;
|
||||
TIMELINE_CLEANUP = true;
|
||||
TIMELINE_MIN_AGE = 1800;
|
||||
TIMELINE_LIMIT_HOURLY = 10;
|
||||
TIMELINE_LIMIT_DAILY = 7;
|
||||
TIMELINE_LIMIT_WEEKLY = 1;
|
||||
TIMELINE_LIMIT_MONTHLY = 0;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
})
|
||||
(inputs.localLib.attrsToList snapper.configs));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user