nixpkgs/pkgs/tools/networking/networkmanager/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

217 lines
5.6 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
, substituteAll
2022-08-17 22:19:59 +00:00
, gettext
, pkg-config
, dbus
, gnome
, systemd
, libuuid
, polkit
, gnutls
, ppp
, dhcpcd
, iptables
, nftables
, python3
, vala
, libgcrypt
, dnsmasq
, bluez5
, readline
, libselinux
, audit
, gobject-introspection
2022-08-17 22:19:59 +00:00
, perl
, modemmanager
, openresolv
, libndp
, newt
, libsoup
, ethtool
, gnused
, iputils
, kmod
, jansson
, elfutils
, gtk-doc
, libxslt
, docbook_xsl
, docbook_xml_dtd_412
, docbook_xml_dtd_42
, docbook_xml_dtd_43
, openconnect
, curl
, meson
, mesonEmulatorHook
, ninja
, libpsl
, mobile-broadband-provider-info
, runtimeShell
, buildPackages
}:
2018-03-07 05:09:48 +00:00
let
pythonForDocs = python3.pythonOnBuildForHost.withPackages (pkgs: with pkgs; [ pygobject3 ]);
in
stdenv.mkDerivation rec {
2021-03-08 15:28:44 +00:00
pname = "networkmanager";
version = "1.46.0";
src = fetchurl {
2021-01-15 09:19:50 +00:00
url = "mirror://gnome/sources/NetworkManager/${lib.versions.majorMinor version}/NetworkManager-${version}.tar.xz";
hash = "sha256-ciZJ4lNiaTszQ3FHOAKnKbDsnuKDN1CWkF+GiAjnQGg=";
};
outputs = [ "out" "dev" "devdoc" "man" "doc" ];
2012-06-16 19:09:30 +00:00
# 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 = [
# System paths
"--sysconfdir=/etc"
"--localstatedir=/var"
"-Dsystemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
# to enable link-local connections
"-Dudev_dir=${placeholder "out"}/lib/udev"
"-Ddbus_conf_dir=${placeholder "out"}/share/dbus-1/system.d"
"-Dkernel_firmware_dir=/run/current-system/firmware"
# Platform
2023-08-15 19:52:49 +00:00
"-Dmodprobe=${kmod}/bin/modprobe"
"-Dsession_tracking=systemd"
"-Dlibaudit=yes-disabled-by-default"
"-Dpolkit_agent_helper_1=/run/wrappers/bin/polkit-agent-helper-1"
# Features
# Allow using iwd when configured to do so
"-Diwd=true"
"-Dpppd=${ppp}/bin/pppd"
"-Diptables=${iptables}/bin/iptables"
"-Dnft=${nftables}/bin/nft"
"-Dmodem_manager=true"
"-Dnmtui=true"
"-Ddnsmasq=${dnsmasq}/bin/dnsmasq"
"-Dqt=false"
# Handlers
"-Dresolvconf=${openresolv}/bin/resolvconf"
# DHCP clients
# ISC DHCP client has reached it's end of life, so stop using it
"-Ddhclient=no"
"-Ddhcpcd=${dhcpcd}/bin/dhcpcd"
"-Ddhcpcanon=no"
# Miscellaneous
# almost cross-compiles, however fails with
# ** (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
"-Ddocs=${lib.boolToString (stdenv.buildPlatform == stdenv.hostPlatform)}"
2020-07-14 12:01:24 +00:00
# We don't use firewalld in NixOS
"-Dfirewalld_zone=false"
"-Dtests=no"
"-Dcrypto=gnutls"
2023-03-05 13:29:19 +00:00
"-Dmobile_broadband_provider_info_database=${mobile-broadband-provider-info}/share/mobile-broadband-provider-info/serviceproviders.xml"
];
2017-04-04 12:16:59 +00:00
patches = [
2018-07-05 20:30:53 +00:00
(substituteAll {
src = ./fix-paths.patch;
2023-08-15 19:52:49 +00:00
inherit iputils openconnect ethtool gnused systemd;
inherit runtimeShell;
2018-07-05 20:30:53 +00:00
})
# 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
2017-04-04 12:16:59 +00:00
];
2018-07-05 20:30:53 +00:00
buildInputs = [
systemd
libselinux
audit
libpsl
libuuid
polkit
ppp
libndp
curl
mobile-broadband-provider-info
bluez5
dnsmasq
modemmanager
readline
newt
libsoup
jansson
dbus # used to get directory paths with pkg-config during configuration
2018-07-05 20:30:53 +00:00
];
propagatedBuildInputs = [ gnutls libgcrypt ];
nativeBuildInputs = [
meson
ninja
2022-08-17 22:19:59 +00:00
gettext
pkg-config
vala
gobject-introspection
2022-08-17 22:19:59 +00:00
perl
elfutils # used to find jansson soname
# Docs
gtk-doc
libxslt
docbook_xsl
docbook_xml_dtd_412
docbook_xml_dtd_42
docbook_xml_dtd_43
pythonForDocs
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
];
doCheck = false; # requires /sys, the net
postPatch = ''
patchShebangs ./tools
patchShebangs libnm/generate-setting-docs.py
# TODO: submit upstream
substituteInPlace meson.build \
--replace "'vala', req" "'vala', native: false, req"
'';
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/src/libnm-client-impl/libnm.so.0 ${placeholder "out"}/lib/libnm.so.0
'';
postFixup = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp -r ${buildPackages.networkmanager.devdoc} $devdoc
cp -r ${buildPackages.networkmanager.man} $man
'';
2018-03-07 05:09:48 +00:00
passthru = {
updateScript = gnome.updateScript {
packageName = "NetworkManager";
2018-03-07 05:09:48 +00:00
attrPath = "networkmanager";
versionPolicy = "odd-unstable";
2018-03-07 05:09:48 +00:00
};
};
meta = with lib; {
homepage = "https://wiki.gnome.org/Projects/NetworkManager";
description = "Network configuration and management tool";
2018-07-05 20:30:53 +00:00
license = licenses.gpl2Plus;
changelog = "https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/raw/${version}/NEWS";
2023-09-12 15:21:05 +00:00
maintainers = teams.freedesktop.members ++ (with maintainers; [ domenkozar obadz amaxine ]);
2018-07-05 20:30:53 +00:00
platforms = platforms.linux;
};
}