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