summary refs log tree commit diff
path: root/pkgs/os-specific/linux/usbip/default.nix
blob: b91f55dcd2fbb998a9d7075e7d582c3f0ccf0eed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ lib, stdenv, fetchpatch, kernel, udev, autoconf, automake, libtool, hwdata, kernelOlder }:

stdenv.mkDerivation {
  name = "usbip-${kernel.name}";

  src = kernel.src;

  patches = lib.optionals (kernelOlder "5.4") [
    # fixes build with gcc8
    ./fix-snprintf-truncation.patch
    # fixes build with gcc9
    ./fix-strncpy-truncation.patch
  ] ++ kernel.patches;

  nativeBuildInputs = [ autoconf automake libtool ];
  buildInputs = [ udev ];

  env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=address-of-packed-member" ];

  preConfigure = ''
    cd tools/usb/usbip
    ./autogen.sh
  '';

  configureFlags = [ "--with-usbids-dir=${hwdata}/share/hwdata/" ];

  meta = with lib; {
    homepage = "https://github.com/torvalds/linux/tree/master/tools/usb/usbip";
    description = "allows to pass USB device from server to client over the network";
    license = with licenses; [ gpl2Only gpl2Plus ];
    platforms = platforms.linux;
    broken = kernelOlder "4.10";
  };
}