feat(fs): add zfs external nix store

This commit is contained in:
514fpv 2024-01-21 20:44:12 +08:00
parent ffa2202f50
commit 0fd97aa5ef
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw

View file

@ -20,6 +20,7 @@ in {
type = with types; attrsOf str; type = with types; attrsOf str;
description = "zfs dataset mountpoints"; description = "zfs dataset mountpoints";
}; };
externalStore = mkEnableOption "external nix store filesystem";
}; };
config = mkIf (cfg.type == "zfs") { config = mkIf (cfg.type == "zfs") {
@ -29,10 +30,11 @@ in {
# required by impermanence # required by impermanence
neededForBoot = true; neededForBoot = true;
}) cfg.zfs.mountpoints) // { }) cfg.zfs.mountpoints) // {
"/nix" = "/nix" = (if !cfg.zfs.externalStore then
{ device = "${cfg.store}/nix"; { device = "${cfg.store}/nix";
fsType = "zfs"; fsType = "zfs";
}; } else
{ inherit (cfg.external) device fsType options; });
}; };
global.fs.zfs.mountpoints."/nix/persist" = "persist"; global.fs.zfs.mountpoints."/nix/persist" = "persist";