nixpkgs/modules/tasks/filesystems/btrfs.nix
Eelco Dolstra 03ebb883d1 * Modularize filesystem support. Filesystems such as btrfs and
reiserfs now have separate modules that are conditional on
  boot.supportedFilesystems and boot.initrd.supportedFilesystems.
  By default, these include the filesystems specified in the fsType
  attribute in fileSystems.  Ext2/3/4 support is currently
  unconditional.

  Also unbreak the installer test (http://hydra.nixos.org/build/2272302). 

svn path=/nixos/trunk/; revision=32954
2012-03-09 14:37:58 +00:00

39 lines
847 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
let
inInitrd = any (fs: fs == "btrfs") config.boot.initrd.supportedFilesystems;
in
{
config = mkIf (any (fs: fs == "btrfs") config.boot.supportedFilesystems) {
system.fsPackages = [ pkgs.btrfsProgs ];
boot.initrd.kernelModules = mkIf inInitrd [ "btrfs" "crc32c" ];
boot.initrd.extraUtilsCommands = mkIf inInitrd
''
cp -v ${pkgs.btrfsProgs}/bin/btrfsck $out/bin
cp -v ${pkgs.btrfsProgs}/bin/btrfs $out/bin
ln -sv btrfsck $out/bin/fsck.btrfs
'';
boot.initrd.postDeviceCommands = mkIf inInitrd
''
btrfs device scan
'';
# !!! This is broken. There should be a udev rule to do this when
# new devices are discovered.
jobs.udev.postStart =
''
${pkgs.btrfsProgs}/bin/btrfs device scan
'';
};
}