nixpkgs/pkgs/by-name/mu/multipath-tools/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

91 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, coreutils
, perl
, pkg-config
, json_c
, libaio
, liburcu
, linuxHeaders
, lvm2
, readline
, systemd
, util-linuxMinimal
, cmocka
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "multipath-tools";
version = "0.9.8";
src = fetchFromGitHub {
owner = "opensvc";
repo = "multipath-tools";
rev = "refs/tags/${version}";
sha256 = "sha256-4cby19BjgnmWf7klK1sBgtZnyvo7q3L1uyVPlVoS+uk=";
};
patches = [
# Backport build fix for musl libc 1.2.5
(fetchpatch {
url = "https://github.com/openSUSE/multipath-tools/commit/e5004de8296cd596aeeac0a61b901e98cf7a69d2.patch";
hash = "sha256-3Qt8zfrWi9aOdqMObZQaNAaXDmjhvSYrXK7qycC9L1Q=";
})
];
postPatch = ''
substituteInPlace create-config.mk \
--replace-fail /bin/echo ${coreutils}/bin/echo
substituteInPlace multipathd/multipathd.service.in \
--replace-fail /sbin/multipathd "$out/bin/multipathd"
'';
nativeBuildInputs = [
perl
pkg-config
];
buildInputs = [
json_c
libaio
liburcu
linuxHeaders
lvm2
readline
systemd
util-linuxMinimal # for libmount
];
makeFlags = [
"LIB=lib"
"prefix=$(out)"
"systemd_prefix=$(out)"
"kernel_incdir=${linuxHeaders}/include/"
"man8dir=$(out)/share/man/man8"
"man5dir=$(out)/share/man/man5"
"man3dir=$(out)/share/man/man3"
];
doCheck = true;
preCheck = ''
# skip test attempting to access /sys/dev/block
substituteInPlace tests/Makefile --replace-fail ' devt ' ' '
'';
nativeCheckInputs = [ cmocka ];
passthru.tests = { inherit (nixosTests) iscsi-multipath-root; };
meta = with lib; {
description = "Tools for the Linux multipathing storage driver";
homepage = "http://christophe.varoqui.free.fr/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}