Add zfs snapshots

This commit is contained in:
Thomas Avé 2024-11-01 15:35:48 +01:00
parent ad1da7816b
commit 066206fa16
2 changed files with 25 additions and 3 deletions

View File

@ -6,6 +6,7 @@ in {
(import ../Common/default.nix { inherit inputs pkgs config; })
(import ../Common/desktop.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit pkgs serverIP; })
(import ../Common/zfs.nix {inherit inputs pkgs config; })
];
hardware.graphics.extraPackages = [
@ -16,10 +17,8 @@ in {
zramSwap.enable = true;
services.upower.enable = true;
services.logind.extraConfig = ''HandlePowerKey=ignore'';
services.throttled.enable = true;
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
services.zfs.autoScrub.enable = true;
networking.hostId = "4e859062";
networking.interfaces.wlan0.useDHCP = lib.mkDefault false;
networking.wireless.iwd.enable = true;

23
hosts/Common/zfs.nix Normal file
View File

@ -0,0 +1,23 @@
{ inputs, config, pkgs, ... }:
{
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
services.zfs.autoScrub.enable = true;
services.sanoid = {
enable = true;
interval = "*:0,15,30,45:00";
datasets = {
"rpool/home" = {
frequently = 8;
yearly = 0;
monthly = 0;
weekly = 0;
daily = 0;
hourly = 0;
frequent_period = 15;
autoprune = true;
autosnap = true;
};
};
};
}