2023-12-02 18:14:48 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2024-02-01 05:40:34 +01:00
|
|
|
, fetchpatch
|
2023-12-02 18:14:48 +01:00
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, which
|
|
|
|
, bison
|
|
|
|
, nixosTests
|
2023-12-02 18:23:15 +01:00
|
|
|
, libnl
|
2023-12-02 18:14:48 +01:00
|
|
|
, linuxHeaders
|
|
|
|
, gnutls
|
|
|
|
}:
|
2009-09-25 04:09:43 +02:00
|
|
|
|
2014-03-20 18:07:15 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2021-08-01 22:48:53 +02:00
|
|
|
pname = "nbd";
|
2023-05-02 17:48:57 +02:00
|
|
|
version = "3.25";
|
2010-07-28 23:28:23 +02:00
|
|
|
|
2009-09-25 04:09:43 +02:00
|
|
|
src = fetchurl {
|
2023-05-02 17:48:57 +02:00
|
|
|
url = "https://github.com/NetworkBlockDevice/nbd/releases/download/nbd-${version}/nbd-${version}.tar.xz";
|
|
|
|
hash = "sha256-9cj9D8tXsckmWU0OV/NWQy7ghni+8dQNCI8IMPDL3Qo=";
|
2009-09-25 04:09:43 +02:00
|
|
|
};
|
2010-07-28 23:28:23 +02:00
|
|
|
|
2024-02-01 05:40:34 +01:00
|
|
|
patches = [
|
|
|
|
# fix port setting from nbdtab
|
|
|
|
# https://github.com/NetworkBlockDevice/nbd/pull/154
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/NetworkBlockDevice/nbd/commit/915444bc0b8a931d32dfb755542f4bd1d37f1449.patch";
|
|
|
|
hash = "sha256-6z+c2cXhY92WPDqRO6AJ5BBf1N38yTgOE1foduIr5Dg=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-12-02 18:14:48 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
which
|
|
|
|
bison
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
gnutls
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2023-12-02 18:23:15 +01:00
|
|
|
libnl
|
2023-12-02 18:14:48 +01:00
|
|
|
linuxHeaders
|
|
|
|
];
|
2018-09-14 19:05:40 +02:00
|
|
|
|
2023-12-08 03:23:31 +01:00
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
];
|
|
|
|
|
2024-02-01 16:02:30 +01:00
|
|
|
# ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration";
|
|
|
|
|
2022-07-20 06:20:00 +02:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2011-05-10 09:15:58 +02:00
|
|
|
|
2022-03-06 14:49:57 +01:00
|
|
|
passthru.tests = {
|
|
|
|
test = nixosTests.nbd;
|
|
|
|
};
|
|
|
|
|
2010-07-28 23:28:23 +02:00
|
|
|
meta = {
|
2022-07-20 06:20:00 +02:00
|
|
|
homepage = "https://nbd.sourceforge.io/";
|
2016-06-20 12:53:46 +02:00
|
|
|
description = "Map arbitrary files as block devices over the network";
|
2021-01-15 10:19:50 +01:00
|
|
|
license = lib.licenses.gpl2;
|
2022-07-20 06:20:00 +02:00
|
|
|
platforms = lib.platforms.unix;
|
2023-12-02 18:20:09 +01:00
|
|
|
maintainers = with lib.maintainers; [ nickcao ];
|
2010-07-28 23:28:23 +02:00
|
|
|
};
|
2009-09-25 04:09:43 +02:00
|
|
|
}
|