Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 72 lines 2.4 kB view raw
1{ lib, stdenv, util-linux, coreutils, fetchurl, groff, system-sendmail, udev }: 2 3stdenv.mkDerivation rec { 4 pname = "mdadm"; 5 version = "4.3"; 6 7 src = fetchurl { 8 url = "mirror://kernel/linux/utils/raid/mdadm/mdadm-${version}.tar.xz"; 9 sha256 = "sha256-QWcnrh8QgOpuMJDOo23QdoJvw2kVHjarc2VXupIZb58="; 10 }; 11 12 patches = [ 13 ./no-self-references.patch 14 ./fix-hardcoded-mapdir.patch 15 # Fixes build on musl 16 (fetchurl { 17 url = "https://raw.githubusercontent.com/void-linux/void-packages/e58d2b17d3c40faffc0d426aab00184f28d9dafa/srcpkgs/mdadm/patches/musl.patch"; 18 hash = "sha256-TIcQs+8RM5Q6Z8MHkI50kaJd7f9WdS/EVI16F7b2+SA="; 19 }) 20 # Fixes build on musl 1.2.5+ 21 (fetchurl { 22 url = "https://lore.kernel.org/linux-raid/20240220165158.3521874-1-raj.khem@gmail.com/raw"; 23 hash = "sha256-JOZ8n7zi+nq236NPpB4e2gUy8I3l3DbcoLhpeL73f98="; 24 }) 25 (fetchurl { 26 url = "https://github.com/md-raid-utilities/mdadm/commit/9dbd11e091f84eb0bf9d717283774816c4c4453d.patch"; 27 hash = "sha256-8GdjP1ceVwejTOFXcHXG8wkIF9/D6hOUGD6btvuqs24="; 28 }) 29 ]; 30 31 makeFlags = [ 32 "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin" 33 "SYSTEMD_DIR=$(out)/lib/systemd/system" 34 "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm" 35 "STRIP=" 36 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 37 "CROSS_COMPILE=${stdenv.cc.targetPrefix}" 38 ]; 39 40 installFlags = [ "install-systemd" ]; 41 42 enableParallelBuilding = true; 43 44 buildInputs = [ udev ]; 45 46 nativeBuildInputs = [ groff ]; 47 48 postPatch = '' 49 sed -e 's@/lib/udev@''${out}/lib/udev@' \ 50 -e 's@ -Werror @ @' \ 51 -e 's@/usr/sbin/sendmail@${system-sendmail}/bin/sendmail@' -i Makefile 52 sed -i \ 53 -e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \ 54 -e 's@BINDIR/blkid@${util-linux}/bin/blkid@g' \ 55 *.rules 56 ''; 57 58 # This is to avoid self-references, which causes the initrd to explode 59 # in size and in turn prevents mdraid systems from booting. 60 postFixup = '' 61 grep -r $out $out/bin && false || true 62 ''; 63 64 meta = with lib; { 65 description = "Programs for managing RAID arrays under Linux"; 66 homepage = "https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git"; 67 license = licenses.gpl2Plus; 68 mainProgram = "mdadm"; 69 maintainers = with maintainers; [ ekleog ]; 70 platforms = platforms.linux; 71 }; 72}