2018-03-29 21:23:36 +02:00
|
|
|
{ stdenv, writeScript
|
2017-06-28 22:39:12 +02:00
|
|
|
, fetchurl, groff
|
|
|
|
, buildPlatform, hostPlatform
|
|
|
|
}:
|
2007-01-10 22:47:03 +01:00
|
|
|
|
2016-01-18 15:00:39 +01:00
|
|
|
assert stdenv.isLinux;
|
|
|
|
|
2018-03-29 21:23:36 +02:00
|
|
|
let
|
|
|
|
sendmail-script = writeScript "sendmail-script" ''
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ -x /run/wrappers/bin/sendmail ]; then
|
|
|
|
/run/wrappers/bin/sendmail "$@"
|
|
|
|
else
|
|
|
|
/run/current-system/sw/bin/sendmail "$@"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
in
|
2010-05-15 20:43:24 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2018-01-27 21:22:52 +01:00
|
|
|
name = "mdadm-4.0";
|
2011-10-06 15:15:09 +02:00
|
|
|
|
2007-01-10 22:47:03 +01:00
|
|
|
src = fetchurl {
|
2015-12-09 19:17:30 +01:00
|
|
|
url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.xz";
|
2018-01-27 21:22:52 +01:00
|
|
|
sha256 = "1ad3mma641946wn5lsllwf0lifw9lps34fv1nnkhyfpd9krffshx";
|
2007-01-10 22:47:03 +01:00
|
|
|
};
|
|
|
|
|
2015-12-09 20:25:40 +01:00
|
|
|
# This is to avoid self-references, which causes the initrd to explode
|
|
|
|
# in size and in turn prevents mdraid systems from booting.
|
2018-03-29 21:23:36 +02:00
|
|
|
allowedReferences = [ stdenv.cc.libc.out sendmail-script ];
|
2015-12-09 20:25:40 +01:00
|
|
|
|
2015-12-09 19:17:30 +01:00
|
|
|
patches = [ ./no-self-references.patch ];
|
|
|
|
|
2015-12-09 20:02:37 +01:00
|
|
|
makeFlags = [
|
|
|
|
"NIXOS=1" "INSTALL=install" "INSTALL_BINDIR=$(out)/sbin"
|
|
|
|
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
2017-07-19 14:59:40 +02:00
|
|
|
"STRIP="
|
2017-06-28 22:39:12 +02:00
|
|
|
] ++ stdenv.lib.optionals (hostPlatform != buildPlatform) [
|
2017-11-25 19:43:57 +01:00
|
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
2015-12-09 20:02:37 +01:00
|
|
|
];
|
|
|
|
|
2012-12-28 19:20:09 +01:00
|
|
|
nativeBuildInputs = [ groff ];
|
2010-05-15 20:43:24 +02:00
|
|
|
|
2015-12-09 20:02:37 +01:00
|
|
|
preConfigure = ''
|
2016-05-04 13:20:39 +02:00
|
|
|
sed -e 's@/lib/udev@''${out}/lib/udev@' \
|
|
|
|
-e 's@ -Werror @ @' \
|
2018-03-29 21:23:36 +02:00
|
|
|
-e 's@/usr/sbin/sendmail@${sendmail-script}@' -i Makefile
|
2015-12-09 20:02:37 +01:00
|
|
|
'';
|
2007-01-10 22:47:03 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Programs for managing RAID arrays under Linux";
|
2010-05-16 22:25:57 +02:00
|
|
|
homepage = http://neil.brown.name/blog/mdadm;
|
2016-08-02 19:50:55 +02:00
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2007-01-10 22:47:03 +01:00
|
|
|
};
|
|
|
|
}
|