at 24.11-pre 1.0 kB view raw
1{ config, lib, pkgs, ... }: 2 3let 4 5 hasExtX = s: s.ext2 or s.ext3 or s.ext4 or false; 6 7 inInitrd = hasExtX config.boot.initrd.supportedFilesystems; 8 inSystem = hasExtX config.boot.supportedFilesystems; 9 10in 11 12{ 13 config = { 14 15 system.fsPackages = lib.mkIf (config.boot.initrd.systemd.enable -> (inInitrd || inSystem)) [ pkgs.e2fsprogs ]; 16 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" ]; 19 20 boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) 21 '' 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 28 ''; 29 30 boot.initrd.systemd.initrdBin = lib.mkIf inInitrd [ pkgs.e2fsprogs ]; 31 32 }; 33}