4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
52 lines
1.5 KiB
Nix
52 lines
1.5 KiB
Nix
{ lib, stdenv, util-linux, coreutils, fetchurl, groff, system-sendmail }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "mdadm-4.1";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.xz";
|
|
sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
|
|
};
|
|
|
|
patches = [ ./no-self-references.patch ];
|
|
|
|
makeFlags = [
|
|
"NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin"
|
|
"SYSTEMD_DIR=$(out)/lib/systemd/system"
|
|
"MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
|
|
"STRIP="
|
|
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
];
|
|
|
|
installFlags = [ "install-systemd" ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
nativeBuildInputs = [ groff ];
|
|
|
|
postPatch = ''
|
|
sed -e 's@/lib/udev@''${out}/lib/udev@' \
|
|
-e 's@ -Werror @ @' \
|
|
-e 's@/usr/sbin/sendmail@${system-sendmail}/bin/sendmail@' -i Makefile
|
|
sed -i \
|
|
-e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \
|
|
-e 's@BINDIR/blkid@${util-linux}/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 lib; {
|
|
description = "Programs for managing RAID arrays under Linux";
|
|
homepage = "http://neil.brown.name/blog/mdadm";
|
|
license = licenses.gpl2;
|
|
maintainers = with maintainers; [ ekleog ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|