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