2022-04-27 09:35:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inInitrd = lib.any (fs: fs == "ext2" || fs == "ext3" || fs == "ext4") config.boot.initrd.supportedFilesystems;
|
2022-11-21 17:40:18 +00:00
|
|
|
inSystem = lib.any (fs: fs == "ext2" || fs == "ext3" || fs == "ext4") config.boot.supportedFilesystems;
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> (inInitrd || inSystem)) [ pkgs.e2fsprogs ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# As of kernel 4.3, there is no separate ext3 driver (they're also handled by ext4.ko)
|
2022-04-27 09:35:20 +00:00
|
|
|
boot.initrd.availableKernelModules = lib.mkIf (config.boot.initrd.systemd.enable -> inInitrd) [ "ext2" "ext4" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|
|
|
|
# Copy e2fsck and friends.
|
|
|
|
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/e2fsck
|
|
|
|
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/tune2fs
|
|
|
|
ln -sv e2fsck $out/bin/fsck.ext2
|
|
|
|
ln -sv e2fsck $out/bin/fsck.ext3
|
|
|
|
ln -sv e2fsck $out/bin/fsck.ext4
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|