server-configs/shared/modules/easy-zfs-mounts.nix

24 lines
675 B
Nix

{ config, lib, ... }:
with lib;
let
cfg = config.mine.zfsMounts;
in {
options.mine.zfsMounts = mkOption {
type = types.attrsOf types.str;
default = {};
};
# config = {
# mine.zfsMounts = let
# zfsFilesystems = lib.filterAttrs (_: v: v.fsType == "zfs") config.fileSystems;
# in lib.mapAttrs' (_: v: lib.nameValuePair v.device v.mountPoint) zfsFilesystems;
# };
# TODO: fix this better. We just do this, so we do not rely on fileSystems, otherwise we cannot
# use this with impermanence
config = {
mine.zfsMounts = lib.mapAttrs' (n: v: lib.nameValuePair ("rpool/" + n) v.mountpoint) config.mine.disks.pools.rpool.datasets;
};
}