at 23.11-pre 804 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 inInitrd = any (fs: fs == "xfs") config.boot.initrd.supportedFilesystems; 8 9in 10 11{ 12 config = mkIf (any (fs: fs == "xfs") config.boot.supportedFilesystems) { 13 14 system.fsPackages = [ pkgs.xfsprogs.bin ]; 15 16 boot.initrd.availableKernelModules = mkIf inInitrd [ "xfs" "crc32c" ]; 17 18 boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) 19 '' 20 copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/fsck.xfs 21 copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/xfs_repair 22 ''; 23 24 # Trick just to set 'sh' after the extraUtils nuke-refs. 25 boot.initrd.extraUtilsCommandsTest = mkIf (inInitrd && !config.boot.initrd.systemd.enable) 26 '' 27 sed -i -e 's,^#!.*,#!'$out/bin/sh, $out/bin/fsck.xfs 28 ''; 29 }; 30}