summary refs log tree commit diff
path: root/pkgs/os-specific/linux/mdadm
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2019-07-25 16:29:39 +0300
committerNikolay Amiantov <ab@fmap.me>2019-08-01 00:55:35 +0300
commit88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c (patch)
tree890834aadedd212c1e1a2156757e766f33a43c0c /pkgs/os-specific/linux/mdadm
parent5636fe572bf0d7176eda11e4a2fd62ccd1577916 (diff)
downloadnixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar.gz
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar.bz2
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar.lz
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar.xz
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.tar.zst
nixpkgs-88d5b40d40cec83934dcbdf29a98e18ea4ff1b8c.zip
mdadm: use absolute paths
We also correct paths in udev rules. This is cleaner and allows for less
unexpected behaviour. We still check for self-references, however we do
it manually now and only for binaries as udev rules can have them.
Rather, we patch them out during initrd generation now.
Diffstat (limited to 'pkgs/os-specific/linux/mdadm')
-rw-r--r--pkgs/os-specific/linux/mdadm/default.nix22
1 files changed, 15 insertions, 7 deletions
diff --git a/pkgs/os-specific/linux/mdadm/default.nix b/pkgs/os-specific/linux/mdadm/default.nix
index 4e0202cebf3..764d43f6c2c 100644
--- a/pkgs/os-specific/linux/mdadm/default.nix
+++ b/pkgs/os-specific/linux/mdadm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, groff, system-sendmail }:
+{ stdenv, utillinux, coreutils, fetchurl, groff, system-sendmail }:
 
 stdenv.mkDerivation rec {
   name = "mdadm-4.1";
@@ -8,26 +8,34 @@ stdenv.mkDerivation rec {
     sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
   };
 
-  # This is to avoid self-references, which causes the initrd to explode
-  # in size and in turn prevents mdraid systems from booting.
-  allowedReferences = [ stdenv.cc.libc.out system-sendmail ];
-
   patches = [ ./no-self-references.patch ];
 
   makeFlags = [
-    "NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
+    "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin"
     "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
     "STRIP="
   ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
   ];
 
+  enableParallelBuilding = true;
+
   nativeBuildInputs = [ groff ];
 
-  preConfigure = ''
+  postPatch = ''
     sed -e 's@/lib/udev@''${out}/lib/udev@' \
         -e 's@ -Werror @ @' \
         -e 's@/usr/sbin/sendmail@${system-sendmail}@' -i Makefile
+    sed -i \
+        -e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \
+        -e 's@BINDIR/blkid@${utillinux}/bin/blkid@g' \
+        *.rules
+  '';
+
+  # This is to avoid self-references, which causes the initrd to explode
+  # in size and in turn prevents mdraid systems from booting.
+  postFixup = ''
+    grep -r $out $out/bin && false || true
   '';
 
   meta = with stdenv.lib; {