2022-04-16 20:46:32 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2024-02-18 23:35:17 +01:00
|
|
|
hasExtX = s: s.ext2 or s.ext3 or s.ext4 or false;
|
|
|
|
|
|
|
|
inInitrd = hasExtX config.boot.initrd.supportedFilesystems;
|
|
|
|
inSystem = hasExtX config.boot.supportedFilesystems;
|
2022-04-16 20:46:32 +01:00
|
|
|
|
|
|
|
in
|
2012-03-09 14:37:58 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
|
2022-11-20 22:27:28 -05:00
|
|
|
system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> (inInitrd || inSystem)) [
|
|
|
|
pkgs.e2fsprogs
|
|
|
|
];
|
2012-03-09 14:37:58 +00:00
|
|
|
|
2017-10-07 04:52:52 +03:00
|
|
|
# As of kernel 4.3, there is no separate ext3 driver (they're also handled by ext4.ko)
|
2022-04-16 20:46:32 +01:00
|
|
|
boot.initrd.availableKernelModules = lib.mkIf (config.boot.initrd.systemd.enable -> inInitrd) [
|
|
|
|
"ext2"
|
|
|
|
"ext4"
|
|
|
|
];
|
2024-12-10 20:26:33 +01:00
|
|
|
|
2022-04-16 20:46:32 +01:00
|
|
|
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
2012-03-09 14:37:58 +00:00
|
|
|
# Copy e2fsck and friends.
|
2015-03-28 17:15:41 -07:00
|
|
|
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/e2fsck
|
|
|
|
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/tune2fs
|
2012-03-09 14:37:58 +00:00
|
|
|
ln -sv e2fsck $out/bin/fsck.ext2
|
|
|
|
ln -sv e2fsck $out/bin/fsck.ext3
|
|
|
|
ln -sv e2fsck $out/bin/fsck.ext4
|
|
|
|
'';
|
|
|
|
|
2023-10-19 21:09:12 -04:00
|
|
|
boot.initrd.systemd.initrdBin = lib.mkIf inInitrd [ pkgs.e2fsprogs ];
|
|
|
|
|
2012-03-09 14:37:58 +00:00
|
|
|
};
|
|
|
|
}
|