1 { stdenv, lib, fetchurl, kernel, flex, coccinelle, python3 }:
3 stdenv.mkDerivation rec {
4 name = "drbd-${version}-${kernel.version}";
8 url = "https://pkg.linbit.com//downloads/drbd/9/drbd-${version}.tar.gz";
9 hash = "sha256-LqK1lPucab7wKvcB4VKGdvBIq+K9XtuO2m0DP5XtK3M=";
12 hardeningDisable = [ "pic" ];
15 kernel.moduleBuildDependencies
22 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
26 # 6.4 and newer provide a in-tree version of the handshake module https://www.kernel.org/doc/html/v6.4/networking/tls-handshake.html
29 install -D drbd/drbd.ko -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9
30 install -D drbd/drbd_transport_tcp.ko -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9
31 install -D drbd/drbd_transport_lb-tcp.ko -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9
32 install -D drbd/drbd_transport_rdma.ko -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9
33 ${lib.optionalString (lib.versionOlder kernel.version "6.4") ''
34 install -D drbd/drbd-kernel-compat/handshake/handshake.ko -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9
41 substituteInPlace Makefile --replace 'SHELL=/bin/bash' 'SHELL=${builtins.getEnv "SHELL"}'
44 # builder.pl had complained about the same file (drbd.ko.xz) provided by two different packages
45 # builder.pl also had complained about different permissions between the files from the two packages
46 # The compression is required because the kernel has the CONFIG_MODULE_COMPRESS_XZ option enabled
48 for ko in $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/block/drbd9/*.ko; do
49 xz --compress -6 --threads=0 $ko
54 enableParallelBuilding = true;
57 homepage = "https://github.com/LINBIT/drbd";
58 description = "LINBIT DRBD kernel module";
59 license = licenses.gpl2Plus;
60 platforms = platforms.linux;
61 maintainers = with maintainers; [ birkb ];
63 DRBD is a software-based, shared-nothing, replicated storage solution
64 mirroring the content of block devices (hard disks, partitions, logical volumes, and so on) between hosts.
66 broken = lib.versionAtLeast kernel.version "6.8"; # wait until next DRBD release for 6.8 support https://github.com/LINBIT/drbd/issues/87#issuecomment-2059323084