diff --git a/nixos/systems/omen/impermenance.nix b/nixos/systems/omen/impermenance.nix index 6725d9f..b806093 100644 --- a/nixos/systems/omen/impermenance.nix +++ b/nixos/systems/omen/impermenance.nix @@ -81,22 +81,7 @@ unitConfig.DefaultDependencies = "no"; serviceConfig.Type = "oneshot"; script = '' - generation="$(zfs get :generation omen-ssd/ephemeral/home -H -o value)" - dataset="omen-ssd/ephemeral/home" - generation="$(("$generation" + 1))" - zfs set ":generation=$generation" "$dataset" - zfs send "$dataset" | zfs recv "$dataset/$generation" - zfs rollback "$dataset@blank" && echo "rollback complete" - - - while IFS="\n" read gen - do - echo "$gen < $(("$generation" - 10))" - if [ "$gen" -lt "$(("$generation" - 10))" ]; then - zfs destroy -r "$dataset/$gen" - echo "destroyed " - fi - done <<< "$(zfs list "omen-ssd/ephemeral/home" -t filesystem -r -H -o name | xargs -I {} ${pkgs.runtimeShell} -c 'echo "$1" | rev | cut -f 1 -d "/" | rev' sh {} | grep -v home)" + ${pkgs.rolling_datasets}/bin/roll_dataset "omen-ssd/ephemeral/home" "10" ''; };