nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchgit,
5 fetchpatch,
6 autoreconfHook,
7 pkg-config,
8 ell,
9 coreutils,
10 docutils,
11 readline,
12 openssl,
13 python3Packages,
14 gitUpdater,
15}:
16
17let
18 # fix segfault in iwctl with readline-8.3
19 # https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.htmlP
20 readline-patch = fetchpatch {
21 url = "https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt";
22 hash = "sha256-QSS1GUJ2i/bF2ksvUtw27oqFHuTHALi+7QwxMFt9ZaM=";
23 stripLen = 2;
24 };
25
26 myreadline = (
27 readline.overrideAttrs (
28 _final: prev: {
29 patches = (prev.patches or [ ]) ++ [ readline-patch ];
30 }
31 )
32 );
33in
34
35stdenv.mkDerivation (finalAttrs: {
36 pname = "iwd";
37 version = "3.9";
38
39 src = fetchgit {
40 url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
41 tag = finalAttrs.version;
42 hash = "sha256-NY0WB62ehxKH64ssAF4vkF6YroG5HHH+ii+AFG9EaE4=";
43 };
44
45 patches = [
46 # Remove dbus config referencing the netdev group, which we don't have.
47 # Users are advised to use the wheel group instead.
48 ./no_netdev_group.diff
49 ];
50
51 outputs = [
52 "out"
53 "man"
54 "doc"
55 ]
56 ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "test";
57 separateDebugInfo = true;
58
59 nativeBuildInputs = [
60 autoreconfHook
61 docutils
62 pkg-config
63 python3Packages.wrapPython
64 ];
65
66 buildInputs = [
67 ell
68 python3Packages.python
69 myreadline
70 ];
71
72 nativeCheckInputs = [ openssl ];
73
74 # wrapPython wraps the scripts in $test. They pull in gobject-introspection,
75 # which doesn't cross-compile.
76 pythonPath = lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
77 python3Packages.dbus-python
78 python3Packages.pygobject3
79 ];
80
81 configureFlags = [
82 "--enable-external-ell"
83 "--enable-wired"
84 "--localstatedir=/var/"
85 "--with-dbus-busdir=${placeholder "out"}/share/dbus-1/system-services/"
86 "--with-dbus-datadir=${placeholder "out"}/share/"
87 "--with-systemd-modloaddir=${placeholder "out"}/etc/modules-load.d/" # maybe
88 "--with-systemd-unitdir=${placeholder "out"}/lib/systemd/system/"
89 "--with-systemd-networkdir=${placeholder "out"}/lib/systemd/network/"
90 ];
91
92 postUnpack = ''
93 mkdir -p iwd/ell
94 ln -s ${ell.src}/ell/useful.h iwd/ell/useful.h
95 ln -s ${ell.src}/ell/asn1-private.h iwd/ell/asn1-private.h
96 patchShebangs .
97 '';
98
99 doCheck = true;
100
101 postInstall = ''
102 mkdir -p $doc/share/doc
103 cp -a doc $doc/share/doc/iwd
104 cp -a README AUTHORS TODO $doc/share/doc/iwd
105 ''
106 + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
107 mkdir -p $test/bin
108 cp -a test/* $test/bin/
109 '';
110
111 preFixup = ''
112 wrapPythonPrograms
113 '';
114
115 postFixup = ''
116 substituteInPlace $out/share/dbus-1/system-services/net.connman.ead.service \
117 --replace-fail /bin/false ${coreutils}/bin/false
118 substituteInPlace $out/share/dbus-1/system-services/net.connman.iwd.service \
119 --replace-fail /bin/false ${coreutils}/bin/false
120 '';
121
122 enableParallelBuilding = true;
123
124 passthru.updateScript = gitUpdater {
125 # No nicer place to find latest release.
126 url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
127 };
128
129 meta = {
130 homepage = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
131 description = "Wireless daemon for Linux";
132 license = lib.licenses.lgpl21Plus;
133 platforms = lib.platforms.linux;
134 maintainers = with lib.maintainers; [
135 dtzWill
136 fpletz
137 ];
138 };
139})