1
Fork 0
satellite/hosts/nixos/calypso/filesystems/default.nix

41 lines
887 B
Nix
Raw Normal View History

2024-08-26 17:38:47 +02:00
{ lib, pkgs, ... }:
{
imports = [ (import ./partitions.nix { }) ];
boot.supportedFilesystems = [ "btrfs" ];
services.btrfs.autoScrub.enable = true;
# {{{ Mark a bunch of paths as needed for boot
fileSystems =
lib.attrsets.genAttrs
[
"/"
"/nix"
"/persist/data"
"/persist/state"
"/persist/local/cache"
"/boot"
]
(p: {
neededForBoot = true;
});
# }}}
# {{{ Rollback
boot.initrd.systemd.services.rollback = {
path = [ pkgs.btrfs-progs ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
unitConfig.DefaultDependencies = "no";
wantedBy = [ "initrd.target" ];
after = [ "systemd-cryptsetup@enc.service" ];
before = [ "sysroot.mount" ];
script = ''
2024-08-27 16:28:49 +02:00
btrfs subvolume delete /
btrfs subvolume create /
2024-08-26 17:38:47 +02:00
'';
};
# }}}
}