2022-08-12 12:06:08 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, glib, which, bison, nixosTests, linuxHeaders, gnutls }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "nbd";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "3.24";
|
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";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-aHcVbSOnsz917uidL1wskcVCr8PNy2Nt6lqIU5pY0Qw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = [ glib gnutls ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ linuxHeaders ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = [ pkg-config which bison ];
|
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
|
|
|
'';
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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 = {
|
2022-08-12 12:06:08 +00:00
|
|
|
homepage = "https://nbd.sourceforge.io/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Map arbitrary files as block devices over the network";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.gpl2;
|
2022-08-12 12:06:08 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|