nix fmt
This commit is contained in:
@@ -1,50 +1,60 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.zfs-root.fileSystems;
|
||||
inherit (lib) types mkDefault mkOption mkMerge mapAttrsToList;
|
||||
in {
|
||||
inherit (lib)
|
||||
types
|
||||
mkDefault
|
||||
mkOption
|
||||
mkMerge
|
||||
mapAttrsToList
|
||||
;
|
||||
in
|
||||
{
|
||||
options.zfs-root.fileSystems = {
|
||||
datasets = mkOption {
|
||||
description = "Set mountpoint for datasets";
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
bindmounts = mkOption {
|
||||
description = "Set mountpoint for bindmounts";
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
efiSystemPartitions = mkOption {
|
||||
description = "Set mountpoint for efi system partitions";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
swapPartitions = mkOption {
|
||||
description = "Set swap partitions";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
config.fileSystems = mkMerge (mapAttrsToList (dataset: mountpoint: {
|
||||
config.fileSystems = mkMerge (
|
||||
mapAttrsToList (dataset: mountpoint: {
|
||||
"${mountpoint}" = {
|
||||
device = "${dataset}";
|
||||
fsType = "zfs";
|
||||
options = ["X-mount.mkdir" "noatime"];
|
||||
options = [
|
||||
"X-mount.mkdir"
|
||||
"noatime"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
})
|
||||
cfg.datasets
|
||||
}) cfg.datasets
|
||||
++ mapAttrsToList (bindsrc: mountpoint: {
|
||||
"${mountpoint}" = {
|
||||
device = "${bindsrc}";
|
||||
fsType = "none";
|
||||
options = ["bind" "X-mount.mkdir" "noatime"];
|
||||
options = [
|
||||
"bind"
|
||||
"X-mount.mkdir"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
})
|
||||
cfg.bindmounts
|
||||
}) cfg.bindmounts
|
||||
++ map (esp: {
|
||||
"/boot/efis/${esp}" = {
|
||||
device = "${config.zfs-root.boot.devNodes}${esp}";
|
||||
@@ -58,15 +68,16 @@ in {
|
||||
"X-mount.mkdir"
|
||||
];
|
||||
};
|
||||
})
|
||||
cfg.efiSystemPartitions);
|
||||
config.swapDevices = mkDefault (map (swap: {
|
||||
}) cfg.efiSystemPartitions
|
||||
);
|
||||
config.swapDevices = mkDefault (
|
||||
map (swap: {
|
||||
device = "${config.zfs-root.boot.devNodes}${swap}";
|
||||
discardPolicy = mkDefault "both";
|
||||
randomEncryption = {
|
||||
enable = true;
|
||||
allowDiscards = mkDefault true;
|
||||
};
|
||||
})
|
||||
cfg.swapPartitions);
|
||||
}) cfg.swapPartitions
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user