2021-04-12 18:23:04 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, libxslt, libaio, systemd, perl
|
2020-11-24 20:58:05 +00:00
|
|
|
, docbook_xsl, coreutils, lsof, rdma-core, makeWrapper, sg3_utils, util-linux
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tgt";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "1.0.82";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fujita";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-05-18 14:49:53 +00:00
|
|
|
sha256 = "sha256-uVd1qPNBIqs9+pRnRP/Q8Z5sXpRdcwBejKjt0BJbXWA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ libxslt docbook_xsl makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ systemd libaio ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
|
|
|
"SD_NOTIFY=1"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i 's|/usr/bin/||' doc/Makefile
|
|
|
|
sed -i 's|/usr/include/libaio.h|${libaio}/include/libaio.h|' usr/Makefile
|
2022-06-16 17:23:12 +00:00
|
|
|
sed -i 's|/usr/include/sys/|${stdenv.cc.libc.dev}/include/sys/|' usr/Makefile
|
|
|
|
sed -i 's|/usr/include/linux/|${stdenv.cc.libc.dev}/include/linux/|' usr/Makefile
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/sbin/tgt-admin \
|
2021-04-12 18:23:04 +00:00
|
|
|
--replace "#!/usr/bin/perl" "#! ${perl.withPackages (p: [ p.ConfigGeneral ])}/bin/perl"
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/sbin/tgt-admin --prefix PATH : \
|
|
|
|
${lib.makeBinPath [ lsof sg3_utils (placeholder "out") ]}
|
|
|
|
|
|
|
|
install -D scripts/tgtd.service $out/etc/systemd/system/tgtd.service
|
|
|
|
substituteInPlace $out/etc/systemd/system/tgtd.service \
|
|
|
|
--replace "/usr/sbin/tgt" "$out/bin/tgt"
|
|
|
|
|
|
|
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=848942
|
|
|
|
sed -i '/ExecStart=/a ExecStartPost=${coreutils}/bin/sleep 5' $out/etc/systemd/system/tgtd.service
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "iSCSI Target daemon with RDMA support";
|
2021-12-26 17:43:05 +00:00
|
|
|
homepage = "https://github.com/fujita/tgt";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ johnazoidberg ];
|
|
|
|
};
|
|
|
|
}
|