lol
1{ lib, stdenv, fetchurl, pkg-config, glib, which, bison, nixosTests, linuxHeaders, gnutls }:
2
3stdenv.mkDerivation rec {
4 pname = "nbd";
5 version = "3.25";
6
7 src = fetchurl {
8 url = "https://github.com/NetworkBlockDevice/nbd/releases/download/nbd-${version}/nbd-${version}.tar.xz";
9 hash = "sha256-9cj9D8tXsckmWU0OV/NWQy7ghni+8dQNCI8IMPDL3Qo=";
10 };
11
12 buildInputs = [ glib gnutls ]
13 ++ lib.optionals stdenv.isLinux [ linuxHeaders ];
14
15 nativeBuildInputs = [ pkg-config which bison ];
16
17 postInstall = ''
18 mkdir -p "$out/share/doc/nbd-${version}"
19 cp README.md "$out/share/doc/nbd-${version}/"
20 '';
21
22 doCheck = !stdenv.isDarwin;
23
24 passthru.tests = {
25 test = nixosTests.nbd;
26 };
27
28 meta = {
29 homepage = "https://nbd.sourceforge.io/";
30 description = "Map arbitrary files as block devices over the network";
31 license = lib.licenses.gpl2;
32 platforms = lib.platforms.unix;
33 };
34}