2022-03-30 09:31:56 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, glib, which, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "nbd";
|
|
|
|
version = "3.21";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-05 21:33:18 +00:00
|
|
|
url = "mirror://sourceforge/nbd/nbd-${version}.tar.xz";
|
2021-02-05 17:12:51 +00:00
|
|
|
sha256 = "sha256-52iK852Rczu80tsIBixE/lA9AE5RUodAE5xEr/amvvk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ glib ]
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optional (stdenv ? glibc) stdenv.glibc.linuxHeaders;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config which ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2021-08-05 21:33:18 +00:00
|
|
|
mkdir -p "$out/share/doc/nbd-${version}"
|
|
|
|
cp README.md "$out/share/doc/nbd-${version}/"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
passthru.tests = {
|
|
|
|
test = nixosTests.nbd;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Glib calls `clock_gettime', which is in librt. Linking that library
|
|
|
|
# here ensures that a proper rpath is added to the executable so that
|
|
|
|
# it can be loaded at run-time.
|
2021-01-15 22:18:51 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString stdenv.isLinux "-lrt -lpthread";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://nbd.sourceforge.net";
|
|
|
|
description = "Map arbitrary files as block devices over the network";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|