2021-06-19 15:36:57 +00:00
{ lib
, stdenv
, fetchurl
, substituteAll
2022-08-17 22:19:59 +00:00
, gettext
2021-06-19 15:36:57 +00:00
, pkg-config
, dbus
, gnome
, systemd
, libuuid
, polkit
, gnutls
, ppp
2022-03-30 18:43:16 +00:00
, dhcpcd
2021-06-19 15:36:57 +00:00
, iptables
2021-06-18 20:35:27 +00:00
, nftables
2021-06-19 15:36:57 +00:00
, python3
, vala
, libgcrypt
, dnsmasq
, bluez5
, readline
, libselinux
, audit
, gobject-introspection
2022-08-17 22:19:59 +00:00
, perl
2021-06-19 15:36:57 +00:00
, modemmanager
, openresolv
, libndp
, newt
, libsoup
, ethtool
, gnused
, iputils
, kmod
, jansson
2022-07-07 18:32:13 +00:00
, elfutils
2021-06-19 15:36:57 +00:00
, gtk-doc
, libxslt
, docbook_xsl
, docbook_xml_dtd_412
, docbook_xml_dtd_42
, docbook_xml_dtd_43
, openconnect
, curl
, meson
2022-07-07 18:32:13 +00:00
, mesonEmulatorHook
2021-06-19 15:36:57 +00:00
, ninja
, libpsl
, mobile-broadband-provider-info
, runtimeShell
2022-07-07 18:32:13 +00:00
, buildPackages
2021-06-19 15:36:57 +00:00
} :
2011-01-03 18:01:10 +00:00
2018-03-07 05:09:48 +00:00
let
2023-11-06 01:38:24 +00:00
pythonForDocs = python3 . pythonOnBuildForHost . withPackages ( pkgs : with pkgs ; [ pygobject3 ] ) ;
2021-06-19 15:36:57 +00:00
in
stdenv . mkDerivation rec {
2021-03-08 15:28:44 +00:00
pname = " n e t w o r k m a n a g e r " ;
2024-02-14 21:35:38 +00:00
version = " 1 . 4 6 . 0 " ;
2011-01-03 18:01:10 +00:00
src = fetchurl {
2021-01-15 09:19:50 +00:00
url = " m i r r o r : / / g n o m e / s o u r c e s / N e t w o r k M a n a g e r / ${ lib . versions . majorMinor version } / N e t w o r k M a n a g e r - ${ version } . t a r . x z " ;
2024-02-14 21:35:38 +00:00
hash = " s h a 2 5 6 - c i Z J 4 l N i a T s z Q 3 F H O A K n K b D s n u K D N 1 C W k F + G i A j n Q G g = " ;
2011-01-03 18:01:10 +00:00
} ;
2019-04-20 03:26:57 +00:00
outputs = [ " o u t " " d e v " " d e v d o c " " m a n " " d o c " ] ;
2012-06-16 19:09:30 +00:00
2011-09-10 19:23:26 +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.
2019-04-20 03:26:57 +00:00
mesonFlags = [
2021-06-19 15:36:57 +00:00
# System paths
" - - s y s c o n f d i r = / e t c "
" - - l o c a l s t a t e d i r = / v a r "
" - D s y s t e m d s y s t e m u n i t d i r = ${ placeholder " o u t " } / e t c / s y s t e m d / s y s t e m "
2018-12-22 20:22:20 +00:00
# to enable link-local connections
2019-04-20 03:26:57 +00:00
" - D u d e v _ d i r = ${ placeholder " o u t " } / l i b / u d e v "
2019-09-13 23:02:38 +00:00
" - D d b u s _ c o n f _ d i r = ${ placeholder " o u t " } / s h a r e / d b u s - 1 / s y s t e m . d "
2019-04-20 03:26:57 +00:00
" - D k e r n e l _ f i r m w a r e _ d i r = / r u n / c u r r e n t - s y s t e m / f i r m w a r e "
2021-06-19 15:36:57 +00:00
# Platform
2023-08-15 19:52:49 +00:00
" - D m o d p r o b e = ${ kmod } / b i n / m o d p r o b e "
2019-04-20 03:26:57 +00:00
" - D s e s s i o n _ t r a c k i n g = s y s t e m d "
2021-06-19 15:36:57 +00:00
" - D l i b a u d i t = y e s - d i s a b l e d - b y - d e f a u l t "
2021-03-08 12:54:34 +00:00
" - D p o l k i t _ a g e n t _ h e l p e r _ 1 = / r u n / w r a p p e r s / b i n / p o l k i t - a g e n t - h e l p e r - 1 "
2021-06-19 15:36:57 +00:00
# Features
2019-04-23 03:12:53 +00:00
# Allow using iwd when configured to do so
" - D i w d = t r u e "
2021-06-19 15:36:57 +00:00
" - D p p p d = ${ ppp } / b i n / p p p d "
" - D i p t a b l e s = ${ iptables } / b i n / i p t a b l e s "
2021-06-18 20:35:27 +00:00
" - D n f t = ${ nftables } / b i n / n f t "
2021-06-19 15:36:57 +00:00
" - D m o d e m _ m a n a g e r = t r u e "
" - D n m t u i = t r u e "
" - D d n s m a s q = ${ dnsmasq } / b i n / d n s m a s q "
" - D q t = f a l s e "
# Handlers
" - D r e s o l v c o n f = ${ openresolv } / b i n / r e s o l v c o n f "
# DHCP clients
2022-03-30 18:43:16 +00:00
# ISC DHCP client has reached it's end of life, so stop using it
" - D d h c l i e n t = n o "
" - D d h c p c d = ${ dhcpcd } / b i n / d h c p c d "
2021-06-19 15:36:57 +00:00
" - D d h c p c a n o n = n o "
# Miscellaneous
2022-07-07 18:32:13 +00:00
# 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
" - D d o c s = ${ lib . boolToString ( stdenv . buildPlatform == stdenv . hostPlatform ) } "
2020-07-14 12:01:24 +00:00
# We don't use firewalld in NixOS
" - D f i r e w a l l d _ z o n e = f a l s e "
2021-06-19 15:36:57 +00:00
" - D t e s t s = n o "
" - D c r y p t o = g n u t l s "
2023-03-05 13:29:19 +00:00
" - D m o b i l e _ b r o a d b a n d _ p r o v i d e r _ i n f o _ d a t a b a s e = ${ mobile-broadband-provider-info } / s h a r e / m o b i l e - b r o a d b a n d - p r o v i d e r - i n f o / s e r v i c e p r o v i d e r s . x m l "
2014-02-13 17:03:06 +00:00
] ;
2011-09-10 19:23:26 +00:00
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 ;
2019-12-23 03:02:09 +00:00
inherit runtimeShell ;
2018-07-05 20:30:53 +00:00
} )
2019-04-20 03:26:57 +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
] ;
2016-10-16 18:29:18 +00:00
2018-07-05 20:30:53 +00:00
buildInputs = [
2021-06-19 15:36:57 +00:00
systemd
libselinux
audit
libpsl
libuuid
polkit
ppp
libndp
curl
mobile-broadband-provider-info
bluez5
dnsmasq
modemmanager
readline
newt
libsoup
jansson
2022-07-07 18:32:13 +00:00
dbus # used to get directory paths with pkg-config during configuration
2018-07-05 20:30:53 +00:00
] ;
2011-09-10 19:23:26 +00:00
2019-09-13 23:02:38 +00:00
propagatedBuildInputs = [ gnutls libgcrypt ] ;
2011-09-14 15:50:01 +00:00
2019-04-20 03:26:57 +00:00
nativeBuildInputs = [
2021-06-19 15:36:57 +00:00
meson
ninja
2022-08-17 22:19:59 +00:00
gettext
2021-06-19 15:36:57 +00:00
pkg-config
vala
gobject-introspection
2022-08-17 22:19:59 +00:00
perl
2022-07-07 18:32:13 +00:00
elfutils # used to find jansson soname
2019-04-20 03:26:57 +00:00
# Docs
2021-06-19 15:36:57 +00:00
gtk-doc
libxslt
docbook_xsl
docbook_xml_dtd_412
docbook_xml_dtd_42
docbook_xml_dtd_43
pythonForDocs
2022-07-07 18:32:13 +00:00
] ++ lib . optionals ( ! stdenv . buildPlatform . canExecute stdenv . hostPlatform ) [
mesonEmulatorHook
2019-04-20 03:26:57 +00:00
] ;
2011-09-13 19:27:41 +00:00
2018-04-25 03:20:18 +00:00
doCheck = false ; # requires /sys, the net
2019-04-20 03:26:57 +00:00
postPatch = ''
patchShebangs ./tools
patchShebangs libnm/generate-setting-docs.py
2022-07-07 18:32:13 +00:00
# TODO: submit upstream
substituteInPlace meson . build \
- - replace " ' v a l a ' , r e q " " ' v a l a ' , n a t i v e : f a l s e , r e q "
2019-05-04 03:47:04 +00:00
'' ;
2014-02-12 11:29:18 +00:00
2019-05-04 03:47:04 +00:00
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 " o u t " } /lib
2021-06-18 20:35:27 +00:00
ln - s $ PWD/src/libnm-client-impl/libnm.so.0 $ { placeholder " o u t " } /lib/libnm.so.0
2019-04-20 03:26:57 +00:00
'' ;
2013-10-03 12:45:25 +00:00
2022-07-07 18:32:13 +00:00
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 = {
2021-05-07 21:18:14 +00:00
updateScript = gnome . updateScript {
2021-06-17 18:56:29 +00:00
packageName = " N e t w o r k M a n a g e r " ;
2018-03-07 05:09:48 +00:00
attrPath = " n e t w o r k m a n a g e r " ;
2021-06-17 18:56:29 +00:00
versionPolicy = " o d d - u n s t a b l e " ;
2018-03-07 05:09:48 +00:00
} ;
} ;
2021-01-11 07:54:33 +00:00
meta = with lib ; {
2020-04-01 01:11:51 +00:00
homepage = " h t t p s : / / w i k i . g n o m e . o r g / P r o j e c t s / N e t w o r k M a n a g e r " ;
2012-12-12 15:26:03 +00:00
description = " N e t w o r k c o n f i g u r a t i o n a n d m a n a g e m e n t t o o l " ;
2018-07-05 20:30:53 +00:00
license = licenses . gpl2Plus ;
2021-06-18 20:35:27 +00:00
changelog = " h t t p s : / / g i t l a b . f r e e d e s k t o p . o r g / N e t w o r k M a n a g e r / N e t w o r k M a n a g e r / - / r a w / ${ version } / N E W S " ;
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 ;
2011-01-03 18:01:10 +00:00
} ;
2011-01-03 19:10:01 +00:00
}