1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/tools/networking/tgt/default.nix
Daniel Schaefer 2f5beaec08 tgt: Install systemd tgtd.service (#65565)
* tgt: Add homepage

* tgt: tgt-admin needs lsof, sg3_utils and tgtadm

Otherwise it fails with return code 72057594037927935.

* tgt: libxslt and docbook_xsl not needed at runtime

They're only there to build the documentation.

* tgt: Install systemd tgtd.service

Resolves #38012

* tgt: Add JohnAZoidberg as maintainer
2019-07-29 23:21:00 +00:00

60 lines
1.8 KiB
Nix

{ stdenv, lib, fetchFromGitHub, libxslt, libaio, systemd, perl, perlPackages
, docbook_xsl, coreutils, lsof, rdma-core, makeWrapper, sg3_utils, utillinux
}:
stdenv.mkDerivation rec {
pname = "tgt";
version = "1.0.79";
src = fetchFromGitHub {
owner = "fujita";
repo = pname;
rev = "v${version}";
sha256 = "18bp7fcpv7879q3ppdxlqj7ayqmlh5zwrkz8gch6rq9lkmmrklrf";
};
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
sed -i 's|/usr/include/sys/|${stdenv.glibc.dev}/include/sys/|' usr/Makefile
sed -i 's|/usr/include/linux/|${stdenv.glibc.dev}/include/linux/|' usr/Makefile
'';
postInstall = ''
substituteInPlace $out/sbin/tgt-admin \
--replace "#!/usr/bin/perl" "#! ${perl}/bin/perl -I${perlPackages.ConfigGeneral}/${perl.libPrefix}"
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;
meta = with stdenv.lib; {
description = "iSCSI Target daemon with RDMA support";
homepage = "http://stgt.sourceforge.net/";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ johnazoidberg ];
};
}