2023-01-25 23:42:13 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-03-02 09:10:21 +00:00
|
|
|
, fetchurl
|
2021-11-03 18:00:49 +00:00
|
|
|
, fetchpatch
|
2023-05-07 20:56:05 +01:00
|
|
|
, autoreconfHook
|
2023-10-03 04:07:51 +01:00
|
|
|
, dbus
|
2020-03-02 09:10:21 +00:00
|
|
|
, file
|
|
|
|
, glib
|
|
|
|
, gnutls
|
2023-10-03 04:07:51 +01:00
|
|
|
, iptables
|
|
|
|
, libmnl
|
|
|
|
, libnftnl # for nftables
|
|
|
|
, nixosTests
|
|
|
|
, openconnect
|
|
|
|
, openvpn
|
|
|
|
, pkg-config
|
|
|
|
, polkit
|
|
|
|
, ppp
|
|
|
|
, pptp
|
2020-03-02 09:10:21 +00:00
|
|
|
, readline
|
2023-10-03 04:07:51 +01:00
|
|
|
, vpnc
|
2020-03-02 09:10:21 +00:00
|
|
|
, dnsType ? "internal" # or "systemd-resolved"
|
|
|
|
, enableBluetooth ? true
|
|
|
|
, enableClient ? true
|
|
|
|
, enableDatafiles ? true
|
2023-10-03 04:07:51 +01:00
|
|
|
, enableDundee ? true
|
|
|
|
, enableEthernet ? true
|
|
|
|
, enableGadget ? true
|
2020-03-02 09:10:21 +00:00
|
|
|
, enableHh2serialGps ? false
|
|
|
|
, enableIospm ? false
|
2023-10-03 04:07:51 +01:00
|
|
|
, enableL2tp ? false
|
|
|
|
, enableLoopback ? true
|
|
|
|
, enableNeard ? true
|
|
|
|
, enableNetworkManager ? null
|
|
|
|
, enableNetworkManagerCompatibility ?
|
|
|
|
if enableNetworkManager == null
|
|
|
|
then false
|
|
|
|
else lib.warn "enableNetworkManager option is deprecated; use enableNetworkManagerCompatibility instead" enableNetworkManager
|
|
|
|
, enableOfono ? true
|
|
|
|
, enableOpenconnect ? true
|
|
|
|
, enableOpenvpn ? true
|
|
|
|
, enablePacrunner ? true
|
|
|
|
, enablePolkit ? true
|
|
|
|
, enablePptp ? true
|
|
|
|
, enableStats ? true
|
2020-03-02 09:10:21 +00:00
|
|
|
, enableTist ? false
|
2023-10-03 04:07:51 +01:00
|
|
|
, enableTools ? true
|
|
|
|
, enableVpnc ? true
|
|
|
|
, enableWifi ? true
|
|
|
|
, enableWireguard ? true
|
|
|
|
, enableWispr ? true
|
|
|
|
, firewallType ? "iptables" # or "nftables"
|
2020-03-02 09:10:21 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-03 04:07:51 +01:00
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
enableFeature
|
|
|
|
enableFeatureAs
|
|
|
|
optionals
|
|
|
|
withFeatureAs;
|
|
|
|
in
|
2021-01-15 09:19:50 +00:00
|
|
|
assert lib.asserts.assertOneOf "firewallType" firewallType [ "iptables" "nftables" ];
|
|
|
|
assert lib.asserts.assertOneOf "dnsType" dnsType [ "internal" "systemd-resolved" ];
|
2023-10-03 04:07:51 +01:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-03-02 09:10:21 +00:00
|
|
|
pname = "connman";
|
2023-08-19 18:22:46 +01:00
|
|
|
version = "1.42";
|
2023-10-03 04:07:51 +01:00
|
|
|
|
2020-03-02 09:10:21 +00:00
|
|
|
src = fetchurl {
|
2023-10-03 04:07:51 +01:00
|
|
|
url = "mirror://kernel/linux/network/connman/connman-${finalAttrs.version}.tar.xz";
|
2023-08-19 18:22:46 +01:00
|
|
|
hash = "sha256-o+a65G/Age8una48qk92Sd6JLD3mIsICg6wMqBQjwqo=";
|
2020-03-02 09:10:21 +00:00
|
|
|
};
|
|
|
|
|
2023-05-07 20:56:05 +01:00
|
|
|
patches = [
|
2023-08-19 18:22:46 +01:00
|
|
|
# simply the middle section of upstream commit a48864a2e5d2a725dfc6eef567108bc13b43857f
|
|
|
|
# dist tarball is broken, hence this patch as a workaround
|
|
|
|
./create-libppp-compat.h.patch
|
|
|
|
] ++ optionals stdenv.hostPlatform.isMusl [
|
2021-11-03 18:00:49 +00:00
|
|
|
# Fix Musl build by avoiding a Glibc-only API.
|
2023-09-14 19:33:26 +01:00
|
|
|
(fetchurl {
|
2021-11-03 18:00:49 +00:00
|
|
|
url = "https://git.alpinelinux.org/aports/plain/community/connman/libresolv.patch?id=e393ea84386878cbde3cccadd36a30396e357d1e";
|
2023-08-19 18:22:46 +01:00
|
|
|
hash = "sha256-7Q1bp8rD/gGVYUqnIXqjr9vypR8jlC926p3KYWl9kLw=";
|
2021-11-03 18:00:49 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-10-03 04:07:51 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
file
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-03-02 09:10:21 +00:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
dbus
|
|
|
|
libmnl
|
|
|
|
gnutls
|
|
|
|
readline
|
2023-10-03 04:07:51 +01:00
|
|
|
]
|
|
|
|
++ optionals (firewallType == "iptables") [ iptables ]
|
|
|
|
++ optionals (firewallType == "nftables") [ libnftnl ]
|
|
|
|
++ optionals (enableOpenconnect) [ openconnect ]
|
|
|
|
++ optionals (enablePolkit) [ polkit ]
|
|
|
|
++ optionals (enablePptp) [ pptp ppp ]
|
2021-11-03 18:00:07 +00:00
|
|
|
;
|
2020-03-02 09:10:21 +00:00
|
|
|
|
2020-03-02 09:13:45 +00:00
|
|
|
postPatch = ''
|
2023-10-03 04:07:51 +01:00
|
|
|
sed -i "s@/usr/bin/file@file@g" ./configure
|
2020-03-02 09:10:21 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# directories flags
|
2020-12-19 15:40:49 +00:00
|
|
|
"--sysconfdir=/etc"
|
2020-03-02 09:10:21 +00:00
|
|
|
"--localstatedir=/var"
|
2023-10-03 04:07:51 +01:00
|
|
|
] ++ [
|
2020-03-02 09:10:21 +00:00
|
|
|
# production build flags
|
2023-10-03 04:07:51 +01:00
|
|
|
(enableFeature false "maintainer-mode")
|
|
|
|
(enableFeatureAs true "session-policy-local" "builtin")
|
2020-03-02 09:10:21 +00:00
|
|
|
# for building and running tests
|
2023-10-03 04:07:51 +01:00
|
|
|
# (enableFeature true "tests") # installs the tests, we don't want that
|
|
|
|
(enableFeature true "tools")
|
|
|
|
(enableFeature enableLoopback "loopback")
|
|
|
|
(enableFeature enableEthernet "ethernet")
|
|
|
|
(enableFeature enableWireguard "wireguard")
|
|
|
|
(enableFeature enableGadget "gadget")
|
|
|
|
(enableFeature enableWifi "wifi")
|
|
|
|
# enable IWD support for wifi as it doesn't require any new dependencies and
|
|
|
|
# it's easier for the NixOS module to use only one connman package when IWD
|
|
|
|
# is requested
|
|
|
|
(enableFeature enableWifi "iwd")
|
|
|
|
(enableFeature enableBluetooth "bluetooth")
|
|
|
|
(enableFeature enableOfono "ofono")
|
|
|
|
(enableFeature enableDundee "dundee")
|
|
|
|
(enableFeature enablePacrunner "pacrunner")
|
|
|
|
(enableFeature enableNeard "neard")
|
|
|
|
(enableFeature enableWispr "wispr")
|
|
|
|
(enableFeature enableTools "tools")
|
|
|
|
(enableFeature enableStats "stats")
|
|
|
|
(enableFeature enableClient "client")
|
|
|
|
(enableFeature enableDatafiles "datafiles")
|
|
|
|
(enableFeature enablePolkit "polkit")
|
|
|
|
(enableFeature enablePptp "pptp")
|
|
|
|
(enableFeature enableWireguard "wireguard")
|
|
|
|
(enableFeature enableNetworkManagerCompatibility "nmcompat")
|
|
|
|
(enableFeature enableHh2serialGps "hh2serial-gps")
|
|
|
|
(enableFeature enableL2tp "l2tp")
|
|
|
|
(enableFeature enableIospm "iospm")
|
|
|
|
(enableFeature enableTist "tist")
|
|
|
|
] ++ [
|
|
|
|
(enableFeatureAs enableOpenconnect "openconnect" "builtin")
|
|
|
|
(enableFeatureAs enableOpenvpn "openvpn" "builtin")
|
|
|
|
(enableFeatureAs enableVpnc "vpnc" "builtin")
|
|
|
|
] ++ [
|
|
|
|
(withFeatureAs true "dbusconfdir" "${placeholder "out"}/share")
|
|
|
|
(withFeatureAs true "dbusdatadir" "${placeholder "out"}/share")
|
|
|
|
(withFeatureAs true "tmpfilesdir" "${placeholder "out"}/tmpfiles.d")
|
|
|
|
(withFeatureAs true "systemdunitdir" "${placeholder "out"}/systemd/system")
|
|
|
|
(withFeatureAs true "dns-backend" "${dnsType}")
|
|
|
|
(withFeatureAs true "firewall" "${firewallType}")
|
|
|
|
(withFeatureAs enableOpenconnect "openconnect" "${openconnect}/sbin/openconnect")
|
|
|
|
(withFeatureAs enableOpenvpn "openvpn" "${openvpn}/sbin/openvpn")
|
|
|
|
(withFeatureAs enableVpnc "vpnc" "${vpnc}/sbin/vpnc")
|
|
|
|
(withFeatureAs enablePptp "pptp" "${pptp}/sbin/pptp")
|
|
|
|
];
|
2020-03-02 09:10:21 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-01-25 23:42:13 +00:00
|
|
|
passthru.tests.connman = nixosTests.connman;
|
|
|
|
|
2023-10-03 04:07:51 +01:00
|
|
|
meta = {
|
2020-03-02 09:10:21 +00:00
|
|
|
description = "A daemon for managing internet connections";
|
2023-10-03 04:07:51 +01:00
|
|
|
homepage = "https://git.kernel.org/pub/scm/network/connman/connman.git/about/";
|
|
|
|
license = lib.licenses.gpl2Only;
|
|
|
|
mainProgram = "connmanctl";
|
|
|
|
maintainers = with lib.maintainers; [ eclairevoyant AndersonTorres ];
|
|
|
|
platforms = lib.platforms.linux;
|
2020-03-02 09:10:21 +00:00
|
|
|
};
|
2023-10-03 04:07:51 +01:00
|
|
|
})
|