summaryrefslogtreecommitdiff
path: root/pkgs/os-specific/linux/usbip/default.nix
blob: 9e5e4f6bfc913d60c7e2f62b222aa217dee91de9 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  lib,
  stdenv,
  kernel,
  udev,
  autoconf,
  automake,
  libtool,
  hwdata,
  kernelOlder,
}:

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

  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 = {
    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 lib.licenses; [
      gpl2Only
      gpl2Plus
    ];
    platforms = lib.platforms.linux;
    broken = kernelOlder "4.10";
  };
}