forked from jan-leila/nix-config
feat: fixed more missing datasets
This commit is contained in:
parent
1145703cfe
commit
2f7bbf3e1c
5 changed files with 65 additions and 4 deletions
|
|
@ -153,7 +153,7 @@ in {
|
|||
config.storage.datasets.replicate)
|
||||
];
|
||||
})
|
||||
(lib.mkIf (config.storage.zfs.enable && !config.storage.impermanence.enable) {
|
||||
(lib.mkIf (config.storage.zfs.enable && !config.storage.impermanence.enable && config.storage.generateBase) {
|
||||
storage.datasets = {
|
||||
# Base organizational datasets (only needed when impermanence is disabled)
|
||||
local = {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ args @ {
|
|||
# Hash function for disk names (max 27 chars to fit GPT limitations)
|
||||
hashDisk = drive: (builtins.substring 0 27 (builtins.hashString "sha256" drive));
|
||||
|
||||
# Map "stripe" to "" for disko compatibility (disko uses "" for stripe mode)
|
||||
diskoPoolMode =
|
||||
if config.storage.zfs.pool.mode == "stripe"
|
||||
then ""
|
||||
else config.storage.zfs.pool.mode;
|
||||
|
||||
# Helper to flatten vdevs into list of devices with names
|
||||
allVdevDevices = lib.lists.flatten (builtins.map (
|
||||
vdev:
|
||||
|
|
@ -260,7 +266,7 @@ in {
|
|||
type = "topology";
|
||||
vdev =
|
||||
builtins.map (vdev: {
|
||||
mode = config.storage.zfs.pool.mode;
|
||||
mode = diskoPoolMode;
|
||||
members = builtins.map (device: hashDisk device.device) vdev;
|
||||
})
|
||||
config.storage.zfs.pool.vdevs;
|
||||
|
|
|
|||
|
|
@ -409,10 +409,13 @@ in {
|
|||
);
|
||||
|
||||
# Post resume commands to rollback user home datasets to blank snapshots
|
||||
boot.initrd.postResumeCommands = lib.mkAfter (
|
||||
# Only add these when generateBase is true -- when false, the legacy
|
||||
# storage config is responsible for providing rollback commands with
|
||||
# the correct (old) dataset paths.
|
||||
boot.initrd.postResumeCommands = lib.mkIf config.storage.generateBase (lib.mkAfter (
|
||||
lib.strings.concatLines (builtins.map (user: "zfs rollback -r rpool/ephemeral/home/${user.name}@blank")
|
||||
normalUsers)
|
||||
);
|
||||
));
|
||||
|
||||
# TODO: I don't think we need this anymore but I have not tested it
|
||||
# Create persist home directories with proper permissions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue