@@ -127,8 +127,8 @@ let
127127 cp -v ${udev}/lib/udev/rules.d/60-persistent-storage.rules $out/
128128 cp -v ${udev}/lib/udev/rules.d/80-drivers.rules $out/
129129 cp -v ${pkgs.lvm2}/lib/udev/rules.d/*.rules $out/
130− cp -v ${pkgs.mdadm}/lib/udev/rules.d/*.rules $out/
131130 cp -v ${pkgs.bcache-tools}/lib/udev/rules.d/*.rules $out/
131+ ${config.boot.initrd.extraUdevRulesCommands}
132132
133133 for i in $out/*.rules; do
134134 substituteInPlace $i \
@@ -302,6 +302,17 @@ in
302302 '';
303303 };
304304
305+ boot.initrd.extraUdevRulesCommands = mkOption {
306+ internal = true;
307+ default = "";
308+ type = types.lines;
309+ description = ''
310+ Shell commands to be executed in the builder of the
311+ udev-rules derivation. This can be used to add
312+ additional udev rules in the initial ramdisk.
313+ '';
314+ };
315+
305316 boot.initrd.compressor = mkOption {
306317 internal = true;
307318 default = "gzip -9";