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