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