lol
at 23.11-beta 216 lines 5.7 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, substituteAll 5, gettext 6, pkg-config 7, dbus 8, gnome 9, systemd 10, libuuid 11, polkit 12, gnutls 13, ppp 14, dhcpcd 15, iptables 16, nftables 17, python3 18, vala 19, libgcrypt 20, dnsmasq 21, bluez5 22, readline 23, libselinux 24, audit 25, gobject-introspection 26, perl 27, modemmanager 28, openresolv 29, libndp 30, newt 31, libsoup 32, ethtool 33, gnused 34, iputils 35, kmod 36, jansson 37, elfutils 38, gtk-doc 39, libxslt 40, docbook_xsl 41, docbook_xml_dtd_412 42, docbook_xml_dtd_42 43, docbook_xml_dtd_43 44, openconnect 45, curl 46, meson 47, mesonEmulatorHook 48, ninja 49, libpsl 50, mobile-broadband-provider-info 51, runtimeShell 52, buildPackages 53}: 54 55let 56 pythonForDocs = python3.pythonOnBuildForHost.withPackages (pkgs: with pkgs; [ pygobject3 ]); 57in 58stdenv.mkDerivation rec { 59 pname = "networkmanager"; 60 version = "1.44.2"; 61 62 src = fetchurl { 63 url = "mirror://gnome/sources/NetworkManager/${lib.versions.majorMinor version}/NetworkManager-${version}.tar.xz"; 64 sha256 = "sha256-S1i/OsV+LO+1ZS79CUXrC0vDamPZKmGrRx2LssmkIOE="; 65 }; 66 67 outputs = [ "out" "dev" "devdoc" "man" "doc" ]; 68 69 # Right now we hardcode quite a few paths at build time. Probably we should 70 # patch networkmanager to allow passing these path in config file. This will 71 # remove unneeded build-time dependencies. 72 mesonFlags = [ 73 # System paths 74 "--sysconfdir=/etc" 75 "--localstatedir=/var" 76 "-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system" 77 # to enable link-local connections 78 "-Dudev_dir=${placeholder "out"}/lib/udev" 79 "-Ddbus_conf_dir=${placeholder "out"}/share/dbus-1/system.d" 80 "-Dkernel_firmware_dir=/run/current-system/firmware" 81 82 # Platform 83 "-Dmodprobe=${kmod}/bin/modprobe" 84 "-Dsession_tracking=systemd" 85 "-Dlibaudit=yes-disabled-by-default" 86 "-Dpolkit_agent_helper_1=/run/wrappers/bin/polkit-agent-helper-1" 87 88 # Features 89 # Allow using iwd when configured to do so 90 "-Diwd=true" 91 "-Dpppd=${ppp}/bin/pppd" 92 "-Diptables=${iptables}/bin/iptables" 93 "-Dnft=${nftables}/bin/nft" 94 "-Dmodem_manager=true" 95 "-Dnmtui=true" 96 "-Ddnsmasq=${dnsmasq}/bin/dnsmasq" 97 "-Dqt=false" 98 99 # Handlers 100 "-Dresolvconf=${openresolv}/bin/resolvconf" 101 102 # DHCP clients 103 # ISC DHCP client has reached it's end of life, so stop using it 104 "-Ddhclient=no" 105 "-Ddhcpcd=${dhcpcd}/bin/dhcpcd" 106 "-Ddhcpcanon=no" 107 108 # Miscellaneous 109 # almost cross-compiles, however fails with 110 # ** (process:9234): WARNING **: Failed to load shared library '/nix/store/...-networkmanager-aarch64-unknown-linux-gnu-1.38.2/lib/libnm.so.0' referenced by the typelib: /nix/store/...-networkmanager-aarch64-unknown-linux-gnu-1.38.2/lib/libnm.so.0: cannot open shared object file: No such file or directory 111 "-Ddocs=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}" 112 # We don't use firewalld in NixOS 113 "-Dfirewalld_zone=false" 114 "-Dtests=no" 115 "-Dcrypto=gnutls" 116 "-Dmobile_broadband_provider_info_database=${mobile-broadband-provider-info}/share/mobile-broadband-provider-info/serviceproviders.xml" 117 ]; 118 119 patches = [ 120 (substituteAll { 121 src = ./fix-paths.patch; 122 inherit iputils openconnect ethtool gnused systemd; 123 inherit runtimeShell; 124 }) 125 126 # Meson does not support using different directories during build and 127 # for installation like Autotools did with flags passed to make install. 128 ./fix-install-paths.patch 129 ]; 130 131 buildInputs = [ 132 systemd 133 libselinux 134 audit 135 libpsl 136 libuuid 137 polkit 138 ppp 139 libndp 140 curl 141 mobile-broadband-provider-info 142 bluez5 143 dnsmasq 144 modemmanager 145 readline 146 newt 147 libsoup 148 jansson 149 dbus # used to get directory paths with pkg-config during configuration 150 ]; 151 152 propagatedBuildInputs = [ gnutls libgcrypt ]; 153 154 nativeBuildInputs = [ 155 meson 156 ninja 157 gettext 158 pkg-config 159 vala 160 gobject-introspection 161 perl 162 elfutils # used to find jansson soname 163 # Docs 164 gtk-doc 165 libxslt 166 docbook_xsl 167 docbook_xml_dtd_412 168 docbook_xml_dtd_42 169 docbook_xml_dtd_43 170 pythonForDocs 171 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 172 mesonEmulatorHook 173 ]; 174 175 doCheck = false; # requires /sys, the net 176 177 postPatch = '' 178 patchShebangs ./tools 179 patchShebangs libnm/generate-setting-docs.py 180 181 # TODO: submit upstream 182 substituteInPlace meson.build \ 183 --replace "'vala', req" "'vala', native: false, req" 184 ''; 185 186 preBuild = '' 187 # Our gobject-introspection patches make the shared library paths absolute 188 # in the GIR files. When building docs, the library is not yet installed, 189 # though, so we need to replace the absolute path with a local one during build. 190 # We are using a symlink that will be overridden during installation. 191 mkdir -p ${placeholder "out"}/lib 192 ln -s $PWD/src/libnm-client-impl/libnm.so.0 ${placeholder "out"}/lib/libnm.so.0 193 ''; 194 195 postFixup = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 196 cp -r ${buildPackages.networkmanager.devdoc} $devdoc 197 cp -r ${buildPackages.networkmanager.man} $man 198 ''; 199 200 passthru = { 201 updateScript = gnome.updateScript { 202 packageName = "NetworkManager"; 203 attrPath = "networkmanager"; 204 versionPolicy = "odd-unstable"; 205 }; 206 }; 207 208 meta = with lib; { 209 homepage = "https://wiki.gnome.org/Projects/NetworkManager"; 210 description = "Network configuration and management tool"; 211 license = licenses.gpl2Plus; 212 changelog = "https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/raw/${version}/NEWS"; 213 maintainers = teams.freedesktop.members ++ (with maintainers; [ domenkozar obadz amaxine ]); 214 platforms = platforms.linux; 215 }; 216}