1 { config, lib, pkgs, ... }:
5 hasExtX = s: s.ext2 or s.ext3 or s.ext4 or false;
7 inInitrd = hasExtX config.boot.initrd.supportedFilesystems;
8 inSystem = hasExtX config.boot.supportedFilesystems;
15 system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> (inInitrd || inSystem)) [ pkgs.e2fsprogs ];
17 # As of kernel 4.3, there is no separate ext3 driver (they're also handled by ext4.ko)
18 boot.initrd.availableKernelModules = lib.mkIf (config.boot.initrd.systemd.enable -> inInitrd) [ "ext2" "ext4" ];
20 boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
22 # Copy e2fsck and friends.
23 copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/e2fsck
24 copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/tune2fs
25 ln -sv e2fsck $out/bin/fsck.ext2
26 ln -sv e2fsck $out/bin/fsck.ext3
27 ln -sv e2fsck $out/bin/fsck.ext4
30 boot.initrd.systemd.initrdBin = lib.mkIf inInitrd [ pkgs.e2fsprogs ];