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
19 ''
20 copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/fsck.xfs
21 '';
22
23 # Trick just to set 'sh' after the extraUtils nuke-refs.
24 boot.initrd.extraUtilsCommandsTest = mkIf inInitrd
25 ''
26 sed -i -e 's,^#!.*,#!'$out/bin/sh, $out/bin/fsck.xfs
27 '';
28 };
29}