summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMatej Cotman <cotman.matej@gmail.com>2014-01-04 01:13:26 +0100
committerRok Garbas <rok@garbas.si>2014-01-11 20:22:53 +0100
commit7d4d3536f72ca0bd4854fad76dd072cf21186938 (patch)
tree52150987939bc1ac59c1fa1314b5cd34e4351499 /nixos
parent501008ad6f742c40888ef2b9ddf983373cd8d38a (diff)
downloadnixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar.gz
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar.bz2
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar.lz
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar.xz
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.tar.zst
nixpkgs-7d4d3536f72ca0bd4854fad76dd072cf21186938.zip
connman: new packages ConnMan v1.20 and connman-ui
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/misc/ids.nix1
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/networking/connman.nix92
3 files changed, 94 insertions, 0 deletions
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
+    '';
+
+  };
+}