1{ lib, stdenv
2, fetchgit
3, autoreconfHook
4, pkg-config
5, ell
6, coreutils
7, docutils
8, readline
9, openssl
10, python3Packages
11}:
12
13stdenv.mkDerivation rec {
14 pname = "iwd";
15 version = "1.30";
16
17 src = fetchgit {
18 url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
19 rev = version;
20 sha256 = "sha256-9uyYXxnxRqWvzrw3QXCOT/ZubQ8/nrB+b60jKn1hAJk=";
21 };
22
23 outputs = [ "out" "man" "doc" ]
24 ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "test";
25
26 nativeBuildInputs = [
27 autoreconfHook
28 docutils
29 pkg-config
30 python3Packages.wrapPython
31 ];
32
33 buildInputs = [
34 ell
35 python3Packages.python
36 readline
37 ];
38
39 checkInputs = [ openssl ];
40
41 # wrapPython wraps the scripts in $test. They pull in gobject-introspection,
42 # which doesn't cross-compile.
43 pythonPath = lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
44 python3Packages.dbus-python
45 python3Packages.pygobject3
46 ];
47
48 configureFlags = [
49 "--enable-external-ell"
50 "--enable-wired"
51 "--localstatedir=/var/"
52 "--with-dbus-busdir=${placeholder "out"}/share/dbus-1/system-services/"
53 "--with-dbus-datadir=${placeholder "out"}/share/"
54 "--with-systemd-modloaddir=${placeholder "out"}/etc/modules-load.d/" # maybe
55 "--with-systemd-unitdir=${placeholder "out"}/lib/systemd/system/"
56 "--with-systemd-networkdir=${placeholder "out"}/lib/systemd/network/"
57 ];
58
59 postUnpack = ''
60 mkdir -p iwd/ell
61 ln -s ${ell.src}/ell/useful.h iwd/ell/useful.h
62 ln -s ${ell.src}/ell/asn1-private.h iwd/ell/asn1-private.h
63 patchShebangs .
64 '';
65
66 doCheck = true;
67
68 postInstall = ''
69 mkdir -p $doc/share/doc
70 cp -a doc $doc/share/doc/iwd
71 cp -a README AUTHORS TODO $doc/share/doc/iwd
72 '' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
73 mkdir -p $test/bin
74 cp -a test/* $test/bin/
75 '';
76
77 preFixup = ''
78 wrapPythonPrograms
79 '';
80
81 postFixup = ''
82 substituteInPlace $out/share/dbus-1/system-services/net.connman.ead.service \
83 --replace /bin/false ${coreutils}/bin/false
84 substituteInPlace $out/share/dbus-1/system-services/net.connman.iwd.service \
85 --replace /bin/false ${coreutils}/bin/false
86 '';
87
88 enableParallelBuilding = true;
89
90 meta = with lib; {
91 homepage = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
92 description = "Wireless daemon for Linux";
93 license = licenses.lgpl21Plus;
94 platforms = platforms.linux;
95 maintainers = with maintainers; [ dtzWill fpletz maxeaubrey ];
96 };
97}