mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-23 11:08:44 +08:00
整理mdadm
This commit is contained in:
parent
782f08d860
commit
4e2a01a90c
@ -139,6 +139,8 @@
|
||||
"/dev/disk/by-uuid/55fdd19f-0f1d-4c37-bd4e-6df44fc31f26" = { mapper = "root"; ssd = true; };
|
||||
"/dev/md/swap" = { mapper = "swap"; ssd = true; };
|
||||
};
|
||||
mdadm =
|
||||
"ARRAY /dev/md/swap metadata=1.2 name=chn-PC:swap UUID=2b546b8d:e38007c8:02990dd1:df9e23a4";
|
||||
};
|
||||
};}
|
||||
)
|
||||
|
@ -124,11 +124,6 @@ inputs:
|
||||
'';
|
||||
};
|
||||
};
|
||||
services.swraid =
|
||||
{
|
||||
enable = true;
|
||||
mdadmConf = "ARRAY /dev/md/swap metadata=1.2 name=chn-PC:swap UUID=2b546b8d:e38007c8:02990dd1:df9e23a4";
|
||||
};
|
||||
# modules in initrd
|
||||
# modprobe --show-depends
|
||||
availableKernelModules =
|
||||
|
@ -11,6 +11,7 @@ inputs:
|
||||
};
|
||||
decrypt.auto = mkOption { type = types.attrsOf (types.submodule { options =
|
||||
{ mapper = mkOption { type = types.nonEmptyStr; }; ssd = mkOption { type = types.bool; }; }; }); };
|
||||
mdadm = mkOption { type = types.nullOr types.str; };
|
||||
|
||||
# swap and resume
|
||||
# swap != resume.device if swap is a file
|
||||
@ -51,23 +52,31 @@ inputs:
|
||||
)
|
||||
(inputs.localLib.attrsToList inputs.config.nixos.fileSystems.mount.btrfs)))
|
||||
);
|
||||
boot.initrd.luks.devices =
|
||||
(
|
||||
builtins.listToAttrs (builtins.map
|
||||
(
|
||||
device:
|
||||
{
|
||||
name = device.value.mapper;
|
||||
value =
|
||||
boot.initrd =
|
||||
{
|
||||
luks.devices =
|
||||
(
|
||||
builtins.listToAttrs (builtins.map
|
||||
(
|
||||
device:
|
||||
{
|
||||
device = device.name;
|
||||
allowDiscards = device.value.ssd;
|
||||
bypassWorkqueues = device.value.ssd;
|
||||
crypttabExtraOpts = [ "fido2-device=auto" ];
|
||||
};
|
||||
}
|
||||
)
|
||||
(inputs.localLib.attrsToList inputs.config.nixos.fileSystems.decrypt.auto))
|
||||
name = device.value.mapper;
|
||||
value =
|
||||
{
|
||||
device = device.name;
|
||||
allowDiscards = device.value.ssd;
|
||||
bypassWorkqueues = device.value.ssd;
|
||||
crypttabExtraOpts = [ "fido2-device=auto" ];
|
||||
};
|
||||
}
|
||||
)
|
||||
(inputs.localLib.attrsToList inputs.config.nixos.fileSystems.decrypt.auto))
|
||||
);
|
||||
}
|
||||
// (
|
||||
if inputs.config.nixos.fileSystems.mdadm != null then
|
||||
{ services.swraid = { enable = true; mdadmConf = inputs.config.nixos.fileSystems.mdadm; }; }
|
||||
else {}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user