3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
aszlig bcd31d0acb
mdadm: 3.3 -> 3.3.4
Okay, this update is a bit more tricky and the patch I've included is
not very nice to be honest.

So the patch causes "mdadm --udev-rules" to search for the right store
path using /proc/self/exec. This has the disadvantage that we could end
up having /run/current-system/bin/mdadm in the rule file.

But on the other hand, when we're on NixOS, we don't need to use that
command *at*all*, so we should be safe.

The patch also sets BINDIR to /sbin, which causes the included rule and
systemd files to not work out of the box on NixOS. But we have a
substituteInPlace where we do rewrite /sbin/mdadm to the right store
path in our udev rule generator, so that shouldn't be an issue.

I've tested this using the mdraid installer test and it succeeded.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-01-18 04:21:15 +01:00

44 lines
1.5 KiB
Nix

{ stdenv, fetchurl, groff }:
stdenv.mkDerivation rec {
name = "mdadm-3.3.4";
# WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING
# Do NOT update this if you're not ABSOLUTELY certain that it will work.
# Please check the update using the NixOS VM test, BEFORE pushing:
# nix-build nixos/release.nix -A tests.installer.swraid.x86_64-linux
# Discussion:
# https://github.com/NixOS/nixpkgs/commit/7719f7f
# https://github.com/NixOS/nixpkgs/commit/666cf99
# https://github.com/NixOS/nixpkgs/pull/6006
# WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING
src = fetchurl {
url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.xz";
sha256 = "0s6a4bq7v7zxiqzv6wn06fv9f6g502dp047lj471jwxq0r9z9rca";
};
patches = [ ./no-self-references.patch ];
nativeBuildInputs = [ groff ];
# Attempt removing if building with gcc5 when updating
NIX_CFLAGS_COMPILE = "-std=gnu89";
preConfigure = "sed -e 's@/lib/udev@\${out}/lib/udev@' -e 's@ -Werror @ @' -i Makefile";
# Force mdadm to use /var/run/mdadm.map for its map file (or
# /dev/.mdadm/map as a fallback).
preBuild =
''
makeFlagsArray=(NIXOS=1 INSTALL=install INSTALL_BINDIR=$out/sbin MANDIR=$out/share/man RUN_DIR=/dev/.mdadm)
if [[ -n "$crossConfig" ]]; then
makeFlagsArray+=(CROSS_COMPILE=$crossConfig-)
fi
'';
meta = {
description = "Programs for managing RAID arrays under Linux";
homepage = http://neil.brown.name/blog/mdadm;
};
}