fix(fs): improve zfs mountpoint handling
This commit is contained in:
parent
41b7ce03fb
commit
777d86ea2f
|
@ -16,25 +16,25 @@ in {
|
||||||
defaults to nix store dataset
|
defaults to nix store dataset
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
mountpoints = mkOption {
|
||||||
|
type = with types; attrsOf str;
|
||||||
|
description = "zfs dataset mountpoints";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.type == "zfs") {
|
config = mkIf (cfg.type == "zfs") {
|
||||||
fileSystems = {
|
fileSystems = (mapAttrs (path: dataset: {
|
||||||
|
device = "${cfg.zfs.persist}/${dataset}";
|
||||||
|
fsType = "zfs";
|
||||||
|
# required by impermanence
|
||||||
|
neededForBoot = true;
|
||||||
|
}) cfg.zfs.mountpoints) // {
|
||||||
"/nix" =
|
"/nix" =
|
||||||
{ device = "${cfg.store}/nix";
|
{ device = "${cfg.store}/nix";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
"/nix/persist" =
|
};
|
||||||
{ device = "${cfg.zfs.persist}/persist";
|
global.fs.zfs.mountpoints."/nix/persist" = "persist";
|
||||||
fsType = "zfs";
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
} // (mapAttrs' (name: opts: nameValuePair
|
|
||||||
"/nix/persist/home/${name}" {
|
|
||||||
device = "${cfg.zfs.persist}/home/${name}";
|
|
||||||
fsType = "zfs";
|
|
||||||
neededForBoot = true;
|
|
||||||
}) (filterAttrs (n: _: n != "root") config.users.profiles));
|
|
||||||
|
|
||||||
services.zfs.trim.enable = true;
|
services.zfs.trim.enable = true;
|
||||||
services.zfs.autoSnapshot.enable = true;
|
services.zfs.autoSnapshot.enable = true;
|
||||||
|
|
Loading…
Reference in a new issue