diff options
Diffstat (limited to 'nixpkgs/pkgs/by-name/co/connman')
-rw-r--r-- | nixpkgs/pkgs/by-name/co/connman/create-libppp-compat.h.patch | 132 | ||||
-rw-r--r-- | nixpkgs/pkgs/by-name/co/connman/package.nix | 176 |
2 files changed, 308 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/co/connman/create-libppp-compat.h.patch b/nixpkgs/pkgs/by-name/co/connman/create-libppp-compat.h.patch new file mode 100644 index 000000000000..dde8a174ca2a --- /dev/null +++ b/nixpkgs/pkgs/by-name/co/connman/create-libppp-compat.h.patch @@ -0,0 +1,132 @@ +new file mode 100644 +index 000000000..eee1d09d6 +--- /dev/null ++++ b/scripts/libppp-compat.h +@@ -0,0 +1,127 @@ ++/* Copyright (C) Eivind Naess, eivnaes@yahoo.com */ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++ ++#ifndef __LIBPPP_COMPAT_H__ ++#define __LIBPPP_COMPAT_H__ ++ ++/* Define USE_EAPTLS compile with EAP TLS support against older pppd headers, ++ * pppd >= 2.5.0 use PPP_WITH_EAPTLS and is defined in pppdconf.h */ ++#define USE_EAPTLS 1 ++ ++/* Define INET6 to compile with IPv6 support against older pppd headers, ++ * pppd >= 2.5.0 use PPP_WITH_IPV6CP and is defined in pppdconf.h */ ++#define INET6 1 ++ ++/* PPP < 2.5.0 defines and exports VERSION which overlaps with current package VERSION define. ++ * this silly macro magic is to work around that. */ ++#undef VERSION ++#include <pppd/pppd.h> ++ ++#ifndef PPPD_VERSION ++#define PPPD_VERSION VERSION ++#endif ++ ++#include <pppd/fsm.h> ++#include <pppd/ccp.h> ++#include <pppd/eui64.h> ++#include <pppd/ipcp.h> ++#include <pppd/ipv6cp.h> ++#include <pppd/eap.h> ++#include <pppd/upap.h> ++ ++#ifdef HAVE_PPPD_CHAP_H ++#include <pppd/chap.h> ++#endif ++ ++#ifdef HAVE_PPPD_CHAP_NEW_H ++#include <pppd/chap-new.h> ++#endif ++ ++#ifdef HAVE_PPPD_CHAP_MS_H ++#include <pppd/chap_ms.h> ++#endif ++ ++#ifndef PPP_PROTO_CHAP ++#define PPP_PROTO_CHAP 0xc223 ++#endif ++ ++#ifndef PPP_PROTO_EAP ++#define PPP_PROTO_EAP 0xc227 ++#endif ++ ++ ++#if WITH_PPP_VERSION < PPP_VERSION(2,5,0) ++ ++static inline bool ++debug_on (void) ++{ ++ return debug; ++} ++ ++static inline const char ++*ppp_ipparam (void) ++{ ++ return ipparam; ++} ++ ++static inline int ++ppp_ifunit (void) ++{ ++ return ifunit; ++} ++ ++static inline const char * ++ppp_ifname (void) ++{ ++ return ifname; ++} ++ ++static inline int ++ppp_get_mtu (int idx) ++{ ++ return netif_get_mtu(idx); ++} ++ ++typedef enum ppp_notify ++{ ++ NF_PID_CHANGE, ++ NF_PHASE_CHANGE, ++ NF_EXIT, ++ NF_SIGNALED, ++ NF_IP_UP, ++ NF_IP_DOWN, ++ NF_IPV6_UP, ++ NF_IPV6_DOWN, ++ NF_AUTH_UP, ++ NF_LINK_DOWN, ++ NF_FORK, ++ NF_MAX_NOTIFY ++} ppp_notify_t; ++ ++typedef void (ppp_notify_fn) (void *ctx, int arg); ++ ++static inline void ++ppp_add_notify (ppp_notify_t type, ppp_notify_fn *func, void *ctx) ++{ ++ struct notifier **list[NF_MAX_NOTIFY] = { ++ [NF_PID_CHANGE ] = &pidchange, ++ [NF_PHASE_CHANGE] = &phasechange, ++ [NF_EXIT ] = &exitnotify, ++ [NF_SIGNALED ] = &sigreceived, ++ [NF_IP_UP ] = &ip_up_notifier, ++ [NF_IP_DOWN ] = &ip_down_notifier, ++ [NF_IPV6_UP ] = &ipv6_up_notifier, ++ [NF_IPV6_DOWN ] = &ipv6_down_notifier, ++ [NF_AUTH_UP ] = &auth_up_notifier, ++ [NF_LINK_DOWN ] = &link_down_notifier, ++ [NF_FORK ] = &fork_notifier, ++ }; ++ ++ struct notifier **notify = list[type]; ++ if (notify) { ++ add_notifier(notify, func, ctx); ++ } ++} ++ ++#endif /* #if WITH_PPP_VERSION < PPP_VERSION(2,5,0) */ ++#endif /* #if__LIBPPP_COMPAT_H__ */ diff --git a/nixpkgs/pkgs/by-name/co/connman/package.nix b/nixpkgs/pkgs/by-name/co/connman/package.nix new file mode 100644 index 000000000000..a90fb1ffd727 --- /dev/null +++ b/nixpkgs/pkgs/by-name/co/connman/package.nix @@ -0,0 +1,176 @@ +{ lib +, stdenv +, fetchurl +, fetchpatch +, autoreconfHook +, dbus +, file +, glib +, gnutls +, iptables +, libmnl +, libnftnl # for nftables +, nixosTests +, openconnect +, openvpn +, pkg-config +, polkit +, ppp +, pptp +, readline +, vpnc +, dnsType ? "internal" # or "systemd-resolved" +, enableBluetooth ? true +, enableClient ? true +, enableDatafiles ? true +, enableDundee ? true +, enableEthernet ? true +, enableGadget ? true +, enableHh2serialGps ? false +, enableIospm ? false +, 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 +, enableTist ? false +, enableTools ? true +, enableVpnc ? true +, enableWifi ? true +, enableWireguard ? true +, enableWispr ? true +, firewallType ? "iptables" # or "nftables" +}: + +let + inherit (lib) + enableFeature + enableFeatureAs + optionals + withFeatureAs; +in +assert lib.asserts.assertOneOf "firewallType" firewallType [ "iptables" "nftables" ]; +assert lib.asserts.assertOneOf "dnsType" dnsType [ "internal" "systemd-resolved" ]; +stdenv.mkDerivation (finalAttrs: { + pname = "connman"; + version = "1.42"; + + src = fetchurl { + url = "mirror://kernel/linux/network/connman/connman-${finalAttrs.version}.tar.xz"; + hash = "sha256-o+a65G/Age8una48qk92Sd6JLD3mIsICg6wMqBQjwqo="; + }; + + patches = [ + # 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 [ + # Fix Musl build by avoiding a Glibc-only API. + (fetchurl { + url = "https://git.alpinelinux.org/aports/plain/community/connman/libresolv.patch?id=e393ea84386878cbde3cccadd36a30396e357d1e"; + hash = "sha256-7Q1bp8rD/gGVYUqnIXqjr9vypR8jlC926p3KYWl9kLw="; + }) + ]; + + nativeBuildInputs = [ + autoreconfHook + file + pkg-config + ]; + + buildInputs = [ + glib + dbus + libmnl + gnutls + readline + ] + ++ optionals (firewallType == "iptables") [ iptables ] + ++ optionals (firewallType == "nftables") [ libnftnl ] + ++ optionals (enableOpenconnect) [ openconnect ] + ++ optionals (enablePolkit) [ polkit ] + ++ optionals (enablePptp) [ pptp ppp ] + ; + + postPatch = '' + sed -i "s@/usr/bin/file@file@g" ./configure + ''; + + configureFlags = [ + # directories flags + "--sysconfdir=/etc" + "--localstatedir=/var" + ] ++ [ + # production build flags + (enableFeature false "maintainer-mode") + (enableFeatureAs true "session-policy-local" "builtin") + # for building and running tests + # (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") + ]; + + doCheck = true; + + passthru.tests.connman = nixosTests.connman; + + meta = { + description = "A daemon for managing internet connections"; + 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; + }; +}) |