2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-03-20 23:00:32 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2012-03-20 23:00:32 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inInitrd = any (fs: fs == "xfs") config.boot.initrd.supportedFilesystems;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
config = mkIf (any (fs: fs == "xfs") config.boot.supportedFilesystems) {
|
|
|
|
|
2015-04-20 22:06:17 +02:00
|
|
|
system.fsPackages = [ pkgs.xfsprogs.bin ];
|
2012-03-20 23:00:32 +01:00
|
|
|
|
2013-10-13 17:18:42 +02:00
|
|
|
boot.initrd.availableKernelModules = mkIf inInitrd [ "xfs" "crc32c" ];
|
2012-03-20 23:00:32 +01:00
|
|
|
|
2022-04-26 21:43:01 +02:00
|
|
|
boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
|
2012-03-20 23:00:32 +01:00
|
|
|
''
|
2015-04-20 22:06:17 +02:00
|
|
|
copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/fsck.xfs
|
2019-07-30 09:28:34 +02:00
|
|
|
copy_bin_and_libs ${pkgs.xfsprogs.bin}/bin/xfs_repair
|
2012-03-20 23:00:32 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Trick just to set 'sh' after the extraUtils nuke-refs.
|
2022-04-26 21:43:01 +02:00
|
|
|
boot.initrd.extraUtilsCommandsTest = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
|
2012-03-20 23:00:32 +01:00
|
|
|
''
|
|
|
|
sed -i -e 's,^#!.*,#!'$out/bin/sh, $out/bin/fsck.xfs
|
|
|
|
'';
|
2023-10-20 03:09:12 +02:00
|
|
|
|
|
|
|
boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.xfsprogs.bin ];
|
2012-03-20 23:00:32 +01:00
|
|
|
};
|
|
|
|
}
|