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