From 7d4d3536f72ca0bd4854fad76dd072cf21186938 Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Sat, 4 Jan 2014 01:13:26 +0100 Subject: [PATCH] connman: new packages ConnMan v1.20 and connman-ui --- lib/maintainers.nix | 1 + nixos/modules/misc/ids.nix | 1 + nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/connman.nix | 92 +++++++++++++++++++ pkgs/tools/networking/connman/default.nix | 59 ++++++++++++ pkgs/tools/networking/connmanui/default.nix | 28 ++++++ pkgs/top-level/all-packages.nix | 4 + 7 files changed, 186 insertions(+) create mode 100644 nixos/modules/services/networking/connman.nix create mode 100644 pkgs/tools/networking/connman/default.nix create mode 100644 pkgs/tools/networking/connmanui/default.nix diff --git a/lib/maintainers.nix b/lib/maintainers.nix index f81bebd9f89..de8e617b322 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -36,6 +36,7 @@ lovek323 = "Jason O'Conal "; ludo = "Ludovic Courtès "; marcweber = "Marc Weber "; + matejc = "Matej Cotman "; modulistic = "Pablo Costa "; mornfall = "Petr Ročkai "; ocharles = "Oliver Charles "; diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 6f2666e4ae5..82041b3f954 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -197,6 +197,7 @@ minidlna = 91; haproxy = 92; openldap = 93; + connman = 94; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 684850df2ae..7f8d7172dc4 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -147,6 +147,7 @@ ./services/networking/avahi-daemon.nix ./services/networking/bind.nix ./services/networking/bitlbee.nix + ./services/networking/connman.nix ./services/networking/cntlm.nix ./services/networking/chrony.nix ./services/networking/ddclient.nix diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix new file mode 100644 index 00000000000..6e36e656830 --- /dev/null +++ b/nixos/modules/services/networking/connman.nix @@ -0,0 +1,92 @@ +{ config, pkgs, ... }: + +with pkgs.lib; +with pkgs; + +let + cfg = config.networking.connman; + +in { + + ###### interface + + options = { + + networking.connman = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to use ConnMan for managing your network connections. + ''; + }; + + }; + + }; + + ###### implementation + + config = mkIf cfg.enable { + + assertions = [{ + assertion = config.networking.useDHCP == false; + message = "You can not use services.networking.connman with services.networking.useDHCP"; + }{ + assertion = config.networking.wireless.enable == true; + message = "You must use services.networking.connman with services.networking.wireless"; + }{ + assertion = config.networking.networkmanager.enable == false; + message = "You can not use services.networking.connman with services.networking.networkmanager"; + }]; + + environment.systemPackages = [ connman ]; + + systemd.services."connman" = { + description = "Connection service"; + wantedBy = [ "multi-user.target" ]; + after = [ "syslog.target" ]; + serviceConfig = { + Type = "dbus"; + BusName = "net.connman"; + Restart = "on-failure"; + ExecStart = "${pkgs.connman}/sbin/connmand --nodaemon"; + StandardOutput = "null"; + }; + }; + + systemd.services."connman-vpn" = { + description = "ConnMan VPN service"; + wantedBy = [ "multi-user.target" ]; + after = [ "syslog.target" ]; + serviceConfig = { + Type = "dbus"; + BusName = "net.connman.vpn"; + ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n"; + StandardOutput = "null"; + }; + }; + + systemd.services."net-connman-vpn" = { + description = "D-BUS Service"; + serviceConfig = { + Name = "net.connman.vpn"; + ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n"; + User = "root"; + SystemdService = "connman-vpn.service"; + }; + }; + + networking = { + useDHCP = false; + wireless.enable = true; + networkmanager.enable = false; + }; + + powerManagement.resumeCommands = '' + systemctl restart connman + ''; + + }; +} diff --git a/pkgs/tools/networking/connman/default.nix b/pkgs/tools/networking/connman/default.nix new file mode 100644 index 00000000000..9a4bab65557 --- /dev/null +++ b/pkgs/tools/networking/connman/default.nix @@ -0,0 +1,59 @@ +{ stdenv, fetchgit, autoconf, automake, libtool, pkgconfig, openconnect, file, + openvpn, vpnc, glib, dbus, iptables, gnutls, policykit, polkit, + wpa_supplicant, readline6, pptp, ppp, tree }: + +stdenv.mkDerivation { + name = "connman-1.20"; + src = fetchgit { + url = "git://git.kernel.org/pub/scm/network/connman/connman.git"; + rev = "8047f3d051b32d38ac0b1e78296b482368728ec6"; + sha256 = "0hb03rzrspgry8z43x8x76vlq1hdq2wggkk7wbidavnqhpmz7dxz"; + }; + + buildInputs = [ autoconf automake libtool pkgconfig openconnect polkit + file openvpn vpnc glib dbus iptables gnutls policykit + wpa_supplicant readline6 pptp ppp tree ]; + + preConfigure = '' + export WPASUPPLICANT=${wpa_supplicant}/sbin/wpa_supplicant + ./bootstrap + sed -i "s/\/usr\/bin\/file/file/g" ./configure + substituteInPlace configure --replace /usr/sbin/pptp ${pptp}/sbin/pptp + substituteInPlace configure --replace /usr/sbin/pppd ${ppp}/sbin/pppd + ''; + + configureFlags = [ + "--sysconfdir=\${out}/etc" + "--localstatedir=/var" + "--with-dbusconfdir=\${out}/etc" + "--with-dbusdatadir=\${out}/usr/share" + "--disable-maintainer-mode" + "--enable-openconnect=builtin" + "--with-openconnect=${openconnect}/sbin/openconnect" + "--enable-openvpn=builtin" + "--with-openvpn=${openvpn}/sbin/openvpn" + "--enable-vpnc=builtin" + "--with-vpnc=${vpnc}/sbin/vpnc" + "--enable-session-policy-local=builtin" + "--enable-client" + "--enable-bluetooth" + "--enable-wifi" + "--enable-polkit" + "--enable-tools" + "--enable-datafiles" + "--enable-pptp" + ]; + + postInstall = '' + cp ./client/connmanctl $out/sbin/connmanctl + ''; + + meta = { + description = "The ConnMan project provides a daemon for managing internet connections"; + homepage = "https://connman.net/"; + maintainers = [ stdenv.lib.maintainers.matejc ]; + # tested only on linux, might work on others also + platforms = stdenv.lib.platforms.linux; + license = stdenv.lib.licenses.gpl2; + }; +} diff --git a/pkgs/tools/networking/connmanui/default.nix b/pkgs/tools/networking/connmanui/default.nix new file mode 100644 index 00000000000..52860c391e0 --- /dev/null +++ b/pkgs/tools/networking/connmanui/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchgit, autoconf, automake, libtool, glib, gtk3, dbus, pkgconfig, file, intltool, connman }: + +stdenv.mkDerivation { + name = "connmanui-b838e640eddb83d296fb6d146ce756066d37c43b"; + src = fetchgit { + url = "git://github.com/tbursztyka/connman-ui.git"; + rev = "973879df2c4a556e5f49d808a88a6a5faba78c73"; + sha256 = "11ps52dn0ws978vv00yrymfvv534v1i9qqx5w93191qjcpjrwj6y"; + }; + + buildInputs = [ autoconf automake libtool glib gtk3 dbus pkgconfig file intltool connman ]; + + preConfigure = '' + set -e + ./autogen.sh + sed -i "s/\/usr\/bin\/file/file/g" ./configure + ''; + + configureScript = "./configure"; + + meta = { + description = "A full-featured GTK based trayicon UI for ConnMan"; + homepage = "https://github.com/tbursztyka/connman-ui"; + maintainers = [ stdenv.lib.maintainers.matejc ]; + platforms = stdenv.lib.platforms.linux; + license = stdenv.lib.licenses.gpl2; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0501d18ebee..510ffe307f6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -685,6 +685,10 @@ let conspy = callPackage ../os-specific/linux/conspy {}; + connman = callPackage ../tools/networking/connman { }; + + connmanui = callPackage ../tools/networking/connmanui { }; + convertlit = callPackage ../tools/text/convertlit { }; collectd = callPackage ../tools/system/collectd { };