nixpkgs/nixos/modules/tasks/swraid.nix
Nikolay Amiantov ca780f4a18 swraid service: use upstream units
This fixes a serious bug on NixOS with swraid where mdadm arrays weren't
properly stopped on shutdown. Rather than fixing the unit by adding
`Before=final.target` we completely move to upstream units, which uses
systemd shutdown hooks instead. This also drives down maintenance costs
for us.
2019-08-01 00:55:35 +03:00

19 lines
389 B
Nix

{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.mdadm ];
services.udev.packages = [ pkgs.mdadm ];
systemd.packages = [ pkgs.mdadm ];
systemd.shutdownPackages = [ pkgs.mdadm ];
boot.initrd.availableKernelModules = [ "md_mod" "raid0" "raid1" "raid10" "raid456" ];
boot.initrd.extraUdevRulesCommands = ''
cp -v ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/
'';
}