at 18.09-beta 129 lines 4.9 kB view raw
1{ stdenv, fetchurl, substituteAll, intltool, pkgconfig, dbus-glib, gnome3 2, systemd, libuuid, polkit, gnutls, ppp, dhcp, iptables 3, libgcrypt, dnsmasq, bluez5, readline 4, gobjectIntrospection, modemmanager, openresolv, libndp, newt, libsoup 5, ethtool, gnused, coreutils, file, inetutils, kmod, jansson, libxslt 6, python3Packages, docbook_xsl, openconnect, curl, autoreconfHook }: 7 8let 9 pname = "NetworkManager"; 10in stdenv.mkDerivation rec { 11 name = "network-manager-${version}"; 12 version = "1.12.2"; 13 14 src = fetchurl { 15 url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 16 sha256 = "09hsh34m8hg4m402pw5n11f29vsfjw6lm3p5m56yxwq57bwnzq3b"; 17 }; 18 19 outputs = [ "out" "dev" ]; 20 21 postPatch = '' 22 patchShebangs ./tools 23 ''; 24 25 preConfigure = '' 26 substituteInPlace configure --replace /usr/bin/uname ${coreutils}/bin/uname 27 substituteInPlace configure --replace /usr/bin/file ${file}/bin/file 28 substituteInPlace data/84-nm-drivers.rules \ 29 --replace /bin/sh ${stdenv.shell} 30 substituteInPlace data/85-nm-unmanaged.rules \ 31 --replace /bin/sh ${stdenv.shell} \ 32 --replace /usr/sbin/ethtool ${ethtool}/sbin/ethtool \ 33 --replace /bin/sed ${gnused}/bin/sed 34 substituteInPlace data/NetworkManager.service.in \ 35 --replace /bin/kill ${coreutils}/bin/kill 36 # to enable link-local connections 37 configureFlags="$configureFlags --with-udev-dir=$out/lib/udev" 38 39 # Fixes: error: po/Makefile.in.in was not created by intltoolize. 40 intltoolize --automake --copy --force 41 ''; 42 43 # Right now we hardcode quite a few paths at build time. Probably we should 44 # patch networkmanager to allow passing these path in config file. This will 45 # remove unneeded build-time dependencies. 46 configureFlags = [ 47 "--with-dhclient=${dhcp}/bin/dhclient" 48 "--with-dnsmasq=${dnsmasq}/bin/dnsmasq" 49 # Upstream prefers dhclient, so don't add dhcpcd to the closure 50 "--with-dhcpcd=no" 51 "--with-pppd=${ppp}/bin/pppd" 52 "--with-iptables=${iptables}/bin/iptables" 53 #"--with-udev-dir=$(out)/lib/udev" 54 "--with-resolvconf=${openresolv}/sbin/resolvconf" 55 "--sysconfdir=/etc" "--localstatedir=/var" 56 "--with-dbus-sys-dir=\${out}/etc/dbus-1/system.d" 57 "--with-crypto=gnutls" "--disable-more-warnings" 58 "--with-systemdsystemunitdir=$(out)/etc/systemd/system" 59 "--with-kernel-firmware-dir=/run/current-system/firmware" 60 "--with-session-tracking=systemd" 61 "--with-modem-manager-1" 62 "--with-nmtui" 63 "--disable-gtk-doc" 64 "--with-libnm-glib" # legacy library, TODO: remove 65 "--disable-tests" 66 ]; 67 68 patches = [ 69 # https://bugzilla.gnome.org/show_bug.cgi?id=796751 70 (fetchurl { 71 url = https://bugzilla.gnome.org/attachment.cgi?id=372953; 72 sha256 = "1crjplyiiipkhjjlifrv6hhvxinlcxd6irp9ijbc7jij31g44i0a"; 73 }) 74 (fetchurl { 75 url = https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/0a3755c1799d3a4dc1875d4c59c7c568a64c8456.patch; 76 sha256 = "af1717f7c6fdd6dadb4082dd847f4bbc42cf1574833299f3e47024e785533f2e"; 77 }) 78 (substituteAll { 79 src = ./fix-paths.patch; 80 inherit inetutils kmod openconnect; 81 }) 82 83 ]; 84 85 buildInputs = [ 86 systemd libuuid polkit ppp libndp curl 87 bluez5 dnsmasq gobjectIntrospection modemmanager readline newt libsoup jansson 88 ]; 89 90 propagatedBuildInputs = [ dbus-glib gnutls libgcrypt python3Packages.pygobject3 ]; 91 92 nativeBuildInputs = [ autoreconfHook intltool pkgconfig libxslt docbook_xsl ]; 93 94 doCheck = false; # requires /sys, the net 95 96 preInstall = '' 97 installFlagsArray=( "sysconfdir=$out/etc" "localstatedir=$out/var" "runstatedir=$out/var/run" ) 98 ''; 99 100 postInstall = '' 101 mkdir -p $out/lib/NetworkManager 102 103 # FIXME: Workaround until NixOS' dbus+systemd supports at_console policy 104 substituteInPlace $out/etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf --replace 'at_console="true"' 'group="networkmanager"' 105 106 # rename to network-manager to be in style 107 mv $out/etc/systemd/system/NetworkManager.service $out/etc/systemd/system/network-manager.service 108 109 # systemd in NixOS doesn't use `systemctl enable`, so we need to establish 110 # aliases ourselves. 111 ln -s $out/etc/systemd/system/NetworkManager-dispatcher.service $out/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service 112 ln -s $out/etc/systemd/system/network-manager.service $out/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service 113 ''; 114 115 passthru = { 116 updateScript = gnome3.updateScript { 117 packageName = pname; 118 attrPath = "networkmanager"; 119 }; 120 }; 121 122 meta = with stdenv.lib; { 123 homepage = https://wiki.gnome.org/Projects/NetworkManager; 124 description = "Network configuration and management tool"; 125 license = licenses.gpl2Plus; 126 maintainers = with maintainers; [ phreedom rickynils domenkozar obadz ]; 127 platforms = platforms.linux; 128 }; 129}