2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-03-09 14:37:58 +00:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2012-03-09 14:37:58 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inInitrd = any (fs: fs == "btrfs") config.boot.initrd.supportedFilesystems;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
config = mkIf (any (fs: fs == "btrfs") config.boot.supportedFilesystems) {
|
|
|
|
|
2016-01-03 18:21:27 +00:00
|
|
|
system.fsPackages = [ pkgs.btrfs-progs ];
|
2012-03-09 14:37:58 +00:00
|
|
|
|
|
|
|
boot.initrd.kernelModules = mkIf inInitrd [ "btrfs" "crc32c" ];
|
|
|
|
|
|
|
|
boot.initrd.extraUtilsCommands = mkIf inInitrd
|
|
|
|
''
|
2016-01-03 18:21:27 +00:00
|
|
|
copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfs
|
2013-05-13 22:07:58 +01:00
|
|
|
ln -sv btrfs $out/bin/btrfsck
|
|
|
|
ln -sv btrfsck $out/bin/fsck.btrfs
|
2012-03-09 14:37:58 +00:00
|
|
|
'';
|
|
|
|
|
2013-05-13 19:07:38 +01:00
|
|
|
boot.initrd.extraUtilsCommandsTest = mkIf inInitrd
|
|
|
|
''
|
|
|
|
$out/bin/btrfs --version
|
|
|
|
'';
|
|
|
|
|
2012-03-09 14:37:58 +00:00
|
|
|
boot.initrd.postDeviceCommands = mkIf inInitrd
|
|
|
|
''
|
|
|
|
btrfs device scan
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|