1{ lib, stdenv, fetchFromGitHub }:
2
3stdenv.mkDerivation {
4 pname = "can-utils";
5 # There are no releases (source archives or git tags), so use the date of the
6 # latest commit in git master as version number.
7 version = "20170830";
8
9 src = fetchFromGitHub {
10 owner = "linux-can";
11 repo = "can-utils";
12 rev = "5b518a0a5fa56856f804372a6b99b518dedb5386";
13 sha256 = "1ygzp8rjr8f1gs48mb1pz7psdgbfhlvr6kjdnmzbsqcml06zvrpr";
14 };
15
16 # Fixup build with newer Linux headers.
17 postPatch = ''
18 sed '1i#include <linux/sockios.h>' -i \
19 slcanpty.c cansniffer.c canlogserver.c isotpdump.c isotpsniffer.c isotpperf.c
20 '';
21
22 preConfigure = ''makeFlagsArray+=(PREFIX="$out")'';
23
24 meta = with lib; {
25 description = "CAN userspace utilities and tools (for use with Linux SocketCAN)";
26 homepage = "https://github.com/linux-can/can-utils";
27 license = licenses.gpl2Plus;
28 platforms = platforms.linux;
29 maintainers = [ maintainers.bjornfor ];
30 };
31}