mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-26 10:06:13 +01:00
d3e46e5413
Signed-off-by: Magic_RB <magic_rb@redalder.org>
25 lines
590 B
Nix
25 lines
590 B
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.magic_rb.erase-my-darlings;
|
|
in
|
|
# Send love to https://grahamc.com/blog/erase-your-darlings
|
|
{
|
|
options = {
|
|
magic_rb.erase-my-darlings = {
|
|
enable = mkEnableOption "Erase the root filesystem using ZFS snapshots on boot.";
|
|
|
|
snapshot = mkOption {
|
|
type = types.str;
|
|
description = "Which snapshot to rollback to, also specifies which dataset to rollback.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
|
zfs rollback -r ${cfg.snapshot}
|
|
'';
|
|
};
|
|
}
|