1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 inInitrd = any (fs: fs == "bcachefs") config.boot.initrd.supportedFilesystems;
8
9in
10
11{
12 config = mkIf (any (fs: fs == "bcachefs") config.boot.supportedFilesystems) {
13
14 system.fsPackages = [ pkgs.bcachefs-tools ];
15
16 # use kernel package with bcachefs support until it's in mainline
17 boot.kernelPackages = pkgs.linuxPackages_testing_bcachefs;
18 boot.initrd.availableKernelModules = mkIf inInitrd [ "bcachefs" ];
19
20 boot.initrd.extraUtilsCommands = mkIf inInitrd
21 ''
22 copy_bin_and_libs ${pkgs.bcachefs-tools}/bin/fsck.bcachefs
23 '';
24
25 };
26}