nixpkgs/modules/tasks/swraid.nix
Eelco Dolstra e91d882a94 * Converted modules that were still using the old (concrete syntax)
style of declaring Upstart jobs.  While at it, converted them to the
  current NixOS module style and improved some option descriptions.
  Hopefully I didn't break too much :-)

svn path=/nixos/trunk/; revision=17761
2009-10-12 16:36:19 +00:00

39 lines
838 B
Nix

{ config, pkgs, ... }:
###### implementation
let
tempConf = "/var/run/mdadm.conf";
modprobe = config.system.sbin.modprobe;
inherit (pkgs) mdadm;
in
{
jobAttrs.swraid =
{ startOn = "udev"; # !!! or on "new-devices"
script =
''
# Load the necessary RAID personalities.
# !!! hm, doesn't the kernel load these automatically?
for mod in raid0 raid1 raid5; do
${modprobe}/sbin/modprobe $mod || true
done
# Scan /proc/partitions for RAID devices.
${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf}
# Activate each device found.
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
initctl emit new-devices
'';
task = true;
};
}