1{ config, pkgs, lib, ... }:
2
3with lib;
4
5let
6 inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
7 fileSystems = filter (x: x.fsType == "f2fs") config.system.build.fileSystems;
8in
9{
10 config = mkIf (any (fs: fs == "f2fs") config.boot.supportedFilesystems) {
11
12 system.fsPackages = [ pkgs.f2fs-tools ];
13
14 boot.initrd.availableKernelModules = mkIf inInitrd [ "f2fs" "crc32" ];
15
16 boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable) ''
17 copy_bin_and_libs ${pkgs.f2fs-tools}/sbin/fsck.f2fs
18 '';
19
20 boot.initrd.systemd.initrdBin = mkIf inInitrd [ pkgs.f2fs-tools ];
21 };
22}