1{ lib
2, stdenv
3, fetchgit
4, perl
5, read-edid
6}:
7
8stdenv.mkDerivation rec {
9 pname = "i2c-tools";
10 version = "4.3";
11
12 src = fetchgit {
13 url = "https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git";
14 rev = "v${version}";
15 sha256 = "sha256-HlmIocum+HZEKNiS5BUwEIswRfTMUhD1vCPibAuAK0Q=";
16 };
17
18 buildInputs = [ perl ];
19
20 postPatch = ''
21 substituteInPlace eeprom/decode-edid \
22 --replace "/usr/sbin/parse-edid" "${read-edid}/bin/parse-edid"
23
24 substituteInPlace stub/i2c-stub-from-dump \
25 --replace "/sbin/" ""
26 '';
27
28 makeFlags = [ "PREFIX=${placeholder "out"}" ];
29
30 outputs = [ "out" "man" ];
31
32 postInstall = ''
33 rm -rf $out/include/linux/i2c-dev.h # conflics with kernel headers
34 '';
35
36 meta = with lib; {
37 description = "Set of I2C tools for Linux";
38 homepage = "https://i2c.wiki.kernel.org/index.php/I2C_Tools";
39 # library is LGPL 2.1 or later; "most tools" GPL 2 or later
40 license = with licenses; [ lgpl21Plus gpl2Plus ];
41 maintainers = [ maintainers.dezgeg ];
42 platforms = platforms.linux;
43 };
44}