nixpkgs/pkgs/tools/networking/network-manager/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

119 lines
4.2 KiB
Nix

{ lib, stdenv, fetchurl, substituteAll, intltool, pkgconfig, fetchpatch, dbus
, gnome3, systemd, libuuid, polkit, gnutls, ppp, dhcp, iptables, python3, vala
, libgcrypt, dnsmasq, bluez5, readline, libselinux, audit
, gobject-introspection, modemmanager, openresolv, libndp, newt, libsoup
, ethtool, gnused, iputils, kmod, jansson, gtk-doc, libxslt
, docbook_xsl, docbook_xml_dtd_412, docbook_xml_dtd_42, docbook_xml_dtd_43
, openconnect, curl, meson, ninja, libpsl, mobile-broadband-provider-info, runtimeShell }:
let
pythonForDocs = python3.withPackages (pkgs: with pkgs; [ pygobject3 ]);
in stdenv.mkDerivation rec {
pname = "network-manager";
version = "1.26.0";
src = fetchurl {
url = "mirror://gnome/sources/NetworkManager/${stdenv.lib.versions.majorMinor version}/NetworkManager-${version}.tar.xz";
sha256 = "0isdqwp58d7r92sqsk7l2vlqwy518n8b7c7z94jk9gc1bdmjf8sj";
};
outputs = [ "out" "dev" "devdoc" "man" "doc" ];
# Right now we hardcode quite a few paths at build time. Probably we should
# patch networkmanager to allow passing these path in config file. This will
# remove unneeded build-time dependencies.
mesonFlags = [
"-Ddhclient=${dhcp}/bin/dhclient"
"-Ddnsmasq=${dnsmasq}/bin/dnsmasq"
# Upstream prefers dhclient, so don't add dhcpcd to the closure
"-Ddhcpcd=no"
"-Ddhcpcanon=no"
"-Dpppd=${ppp}/bin/pppd"
"-Diptables=${iptables}/bin/iptables"
# to enable link-local connections
"-Dudev_dir=${placeholder "out"}/lib/udev"
"-Dresolvconf=${openresolv}/bin/resolvconf"
"-Ddbus_conf_dir=${placeholder "out"}/share/dbus-1/system.d"
"-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
"-Dkernel_firmware_dir=/run/current-system/firmware"
"--sysconfdir=/etc"
"--localstatedir=/var"
"-Dcrypto=gnutls"
"-Dsession_tracking=systemd"
"-Dmodem_manager=true"
"-Dnmtui=true"
"-Ddocs=true"
"-Dtests=no"
"-Dqt=false"
# Allow using iwd when configured to do so
"-Diwd=true"
"-Dlibaudit=yes-disabled-by-default"
# We don't use firewalld in NixOS
"-Dfirewalld_zone=false"
];
patches = [
(substituteAll {
src = ./fix-paths.patch;
inherit iputils kmod openconnect ethtool gnused systemd polkit;
inherit runtimeShell;
})
# Meson does not support using different directories during build and
# for installation like Autotools did with flags passed to make install.
./fix-install-paths.patch
# Fix build
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/620
(fetchpatch {
url = "https://gitlab.freedesktop.org/NetworkManager/NetworkManager/commit/54e25f23f53af889703dfc50d51a8afeeea8a439.patch";
sha256 = "oy/AZhOC15anWeIMYJfDBcITqJ7CiU715he68XvPRxk=";
})
];
buildInputs = [
systemd libselinux audit libpsl libuuid polkit ppp libndp curl mobile-broadband-provider-info
bluez5 dnsmasq gobject-introspection modemmanager readline newt libsoup jansson
];
propagatedBuildInputs = [ gnutls libgcrypt ];
nativeBuildInputs = [
meson ninja intltool pkgconfig
vala gobject-introspection dbus
# Docs
gtk-doc libxslt docbook_xsl docbook_xml_dtd_412 docbook_xml_dtd_42 docbook_xml_dtd_43 pythonForDocs
];
doCheck = false; # requires /sys, the net
postPatch = ''
patchShebangs ./tools
patchShebangs libnm/generate-setting-docs.py
'';
preBuild = ''
# Our gobject-introspection patches make the shared library paths absolute
# in the GIR files. When building docs, the library is not yet installed,
# though, so we need to replace the absolute path with a local one during build.
# We are using a symlink that will be overridden during installation.
mkdir -p ${placeholder "out"}/lib
ln -s $PWD/libnm/libnm.so.0 ${placeholder "out"}/lib/libnm.so.0
'';
passthru = {
updateScript = gnome3.updateScript {
packageName = pname;
attrPath = "networkmanager";
};
};
meta = with lib; {
homepage = "https://wiki.gnome.org/Projects/NetworkManager";
description = "Network configuration and management tool";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ phreedom domenkozar obadz worldofpeace ];
platforms = platforms.linux;
};
}