1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 inInitrd = any (fs: fs == "vfat") config.boot.initrd.supportedFilesystems;
8
9in
10
11{
12 config = mkIf (any (fs: fs == "vfat") config.boot.supportedFilesystems) {
13
14 system.fsPackages = [ pkgs.dosfstools pkgs.mtools ];
15
16 boot.initrd.kernelModules = mkIf inInitrd [ "vfat" "nls_cp437" "nls_iso8859-1" ];
17
18 boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
19 ''
20 copy_bin_and_libs ${pkgs.dosfstools}/sbin/dosfsck
21 ln -sv dosfsck $out/bin/fsck.vfat
22 '';
23
24 };
25}