1.7 KiB
1.7 KiB
Sanoid Block
Defined in /modules/blocks/sanoid.nix:
{
imports = [
inputs.selfhostblocks.nixosModules.sanoid
];
}
Provider Contracts
This block provides the following contracts:
- backup contract under the
shb.sanoid.backupoption. It is tested with the generic contract tests.
Usage
Sanoid uses templates to know when snapshots should be kept or pruned.
Default Template
Backup a dataset using the default Sanoid template:
{
shb.zfs.pools.root.datasets.home = {
path = "/home";
};
shb.sanoid.backup."root/home" = { };
}
Custom Template
Create a custom template and use it:
{
shb.zfs.pools.root.datasets.home = {
path = "/home";
};
services.sanoid.templates."yearly" = {
hourly = 10;
daily = 3;
monthly = 3;
yearly = 2;
};
shb.sanoid.backup."root/home" = {
template = "yearly";
};
}
Note we use the upstream services.sanoid.templates option to define the templates.
Custom Template
Create a custom template and use it:
{
shb.zfs.pools.root.datasets.home = {
path = "/home";
};
shb.sanoid.backup."root/home";
}
Options Reference
id-prefix: blocks-sanoid-options-
list-id: selfhostblocks-blocks-sanoid-options
source: @OPTIONS_JSON@