1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 inInitrd = config.boot.initrd.supportedFilesystems.vfat or false;
8
9in
10
11{
12 config = mkIf (config.boot.supportedFilesystems.vfat or false) {
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 boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.dosfstools ];
25
26 };
27}