Compare commits

...

2 Commits

3 changed files with 28 additions and 72 deletions

View File

@ -19,7 +19,7 @@
ataraxia.filesystems.btrfs.enable = true; ataraxia.filesystems.btrfs.enable = true;
ataraxia.filesystems.btrfs.eraseOnBoot.enable = true; ataraxia.filesystems.btrfs.eraseOnBoot.enable = true;
ataraxia.filesystems.btrfs.eraseOnBoot.device = "/dev/sda4"; ataraxia.filesystems.btrfs.eraseOnBoot.device = "/dev/sda4";
ataraxia.filesystems.btrfs.eraseOnBoot.systemdDevice = ataraxia.filesystems.btrfs.eraseOnBoot.waitForDevice =
"sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio3-host0-target0:0:0-0:0:0:0-block-sda.device"; "sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio3-host0-target0:0:0-0:0:0:0-block-sda.device";
ataraxia.filesystems.btrfs.eraseOnBoot.eraseVolumes = [ ataraxia.filesystems.btrfs.eraseOnBoot.eraseVolumes = [
{ {

View File

@ -5,6 +5,12 @@
disko.devices.disk.disk1 = disko.devices.disk.disk1 =
let let
device = "/dev/sda"; device = "/dev/sda";
defaultMountOpts = [
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
in in
{ {
inherit device; inherit device;
@ -58,94 +64,44 @@
"/snapshots" = { }; "/snapshots" = { };
"/rootfs" = { "/rootfs" = {
mountpoint = "/"; mountpoint = "/";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/homefs" = { "/homefs" = {
mountpoint = "/home"; mountpoint = "/home";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist" = { }; "/persist" = { };
"/persist/nix" = { "/persist/nix" = {
mountpoint = "/nix"; mountpoint = "/nix";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/srv" = { "/persist/srv" = {
mountpoint = "/srv"; mountpoint = "/srv";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/docker" = { "/persist/docker" = {
mountpoint = "/var/lib/docker"; mountpoint = "/var/lib/docker";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/podman" = { "/persist/podman" = {
mountpoint = "/var/lib/podman"; mountpoint = "/var/lib/podman";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/containers" = { "/persist/containers" = {
mountpoint = "/var/lib/containers"; mountpoint = "/var/lib/containers";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/libvirt" = { "/persist/libvirt" = {
mountpoint = "/var/lib/libvirt"; mountpoint = "/var/lib/libvirt";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/log" = { "/persist/log" = {
mountpoint = "/var/log"; mountpoint = "/var/log";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
"/persist/impermanence" = { "/persist/impermanence" = {
mountpoint = "/persist"; mountpoint = "/persist";
mountOptions = [ mountOptions = defaultMountOpts;
"compress=zstd"
"noatime"
"autodefrag"
"ssd"
];
}; };
}; };
}; };

View File

@ -48,15 +48,6 @@ in
default = config.persist.enable; default = config.persist.enable;
description = "Clean btrfs subvolumes on boot"; description = "Clean btrfs subvolumes on boot";
}; };
device = mkOption {
type = str;
description = "Device on which is btrfs partititon";
};
systemdDevice = mkOption {
type = str;
description = "Escaped string with name of .device service";
example = "dev-disk-by\\x2did-ata\\x2dPhison_SATA_SSD_2165.device";
};
eraseVolumes = mkOption { eraseVolumes = mkOption {
type = listOf (submodule eraseVolumesOpts); type = listOf (submodule eraseVolumesOpts);
default = [ ]; default = [ ];
@ -70,6 +61,15 @@ in
A list of subvolumes to erase on boot. A list of subvolumes to erase on boot.
''; '';
}; };
device = mkOption {
type = str;
description = "Device on which is btrfs partititon";
};
waitForDevice = mkOption {
type = str;
description = "Escaped string with name of .device service";
example = "dev-disk-by\\x2did-ata\\x2dPhison_SATA_SSD_2165.device";
};
}; };
}; };
@ -105,8 +105,8 @@ in
systemd.services.rollback = mkIf config.boot.initrd.systemd.enable { systemd.services.rollback = mkIf config.boot.initrd.systemd.enable {
description = "Rollback btrfs root subvolume to a pristine state on boot"; description = "Rollback btrfs root subvolume to a pristine state on boot";
wantedBy = [ "initrd.target" ]; wantedBy = [ "initrd.target" ];
requires = [ cfg.eraseOnBoot.systemdDevice ]; requires = [ cfg.eraseOnBoot.waitForDevice ];
after = [ cfg.eraseOnBoot.systemdDevice ]; after = [ cfg.eraseOnBoot.waitForDevice ];
before = [ "sysroot.mount" ]; before = [ "sysroot.mount" ];
path = [ path = [
pkgs.btrfs-progs pkgs.btrfs-progs