summary refs log tree commit diff
diff options
context:
space:
mode:
authorEdmund Wu <fangkazuto@gmail.com>2020-10-24 21:12:05 -0400
committerGabriel Ebner <gebner@gebner.org>2020-11-10 20:53:13 +0100
commit4d0ad2783d17c78910096784e5a8913a8888e503 (patch)
treedde5bb7ae1a029e76fdfda3c229197ebee9a9646
parent0f83b301aa78ced03010d11d84baf6a8805c495d (diff)
downloadnixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar.gz
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar.bz2
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar.lz
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar.xz
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.tar.zst
nixpkgs-4d0ad2783d17c78910096784e5a8913a8888e503.zip
nixos/*: hsphfpd support
-rw-r--r--nixos/modules/services/hardware/bluetooth.nix32
1 files changed, 28 insertions, 4 deletions
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index 230492c6b09..6f5a6d3bf28 100644
--- a/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixos/modules/services/hardware/bluetooth.nix
@@ -15,6 +15,8 @@ in {
     hardware.bluetooth = {
       enable = mkEnableOption "support for Bluetooth";
 
+      hsphfpd.enable = mkEnableOption "support for hsphfpd[-prototype] implementation";
+
       powerOnBoot = mkOption {
         type    = types.bool;
         default = true;
@@ -72,7 +74,8 @@ in {
       };
     };
 
-    environment.systemPackages = [ bluez-bluetooth ];
+    environment.systemPackages = [ bluez-bluetooth ]
+      ++ optionals cfg.hsphfpd.enable [ pkgs.hsphfpd ];
 
     environment.etc."bluetooth/main.conf"= {
       source = pkgs.writeText "main.conf"
@@ -80,7 +83,8 @@ in {
     };
 
     services.udev.packages = [ bluez-bluetooth ];
-    services.dbus.packages = [ bluez-bluetooth ];
+    services.dbus.packages = [ bluez-bluetooth ]
+      ++ optionals cfg.hsphfpd.enable [ pkgs.hsphfpd ];
     systemd.packages       = [ bluez-bluetooth ];
 
     systemd.services = {
@@ -90,11 +94,31 @@ in {
         # restarting can leave people without a mouse/keyboard
         unitConfig.X-RestartIfChanged = false;
       };
-    };
+    }
+      // (optionalAttrs cfg.hsphfpd.enable {
+        hsphfpd = {
+          after = [ "bluetooth.service" ];
+          requires = [ "bluetooth.service" ];
+          wantedBy = [ "multi-user.target" ];
+
+          description = "A prototype implementation used for connecting HSP/HFP Bluetooth devices";
+          serviceConfig.ExecStart = "${pkgs.hsphfpd}/bin/hsphfpd.pl";
+        };
+      })
+      ;
 
     systemd.user.services = {
       obex.aliases = [ "dbus-org.bluez.obex.service" ];
-    };
+    }
+      // (optionalAttrs cfg.hsphfpd.enable {
+        telephony_client = {
+          wantedBy = [ "default.target"];
+
+          description = "telephony_client for hsphfpd";
+          serviceConfig.ExecStart = "${pkgs.hsphfpd}/bin/telephony_client.pl";
+        };
+      })
+      ;
 
   };