summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-04-16 18:09:51 +0200
committerGitHub <noreply@github.com>2017-04-16 18:09:51 +0200
commit16f5bc07f80d8b8e549fff305dd3212ccec43fe4 (patch)
tree68cb21dcb85a4f86fb9aaa88c360285faa06b375 /nixos
parent69d77eaa288a7d946e467402afe7e2ea2519725d (diff)
parent99d4ed58616358c71b81370130b3610744370028 (diff)
downloadnixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar.gz
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar.bz2
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar.lz
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar.xz
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.tar.zst
nixpkgs-16f5bc07f80d8b8e549fff305dd3212ccec43fe4.zip
Merge pull request #24948 from peterhoeg/m/bluetooth
bluetooth: use upstream's recommendation for enabling interfaces
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/bluetooth.nix31
1 files changed, 9 insertions, 22 deletions
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index f1fcb436934..4a8cd86b0b1 100644
--- a/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixos/modules/services/hardware/bluetooth.nix
@@ -6,9 +6,7 @@ let
   bluez-bluetooth = pkgs.bluez;
   cfg = config.hardware.bluetooth;
 
-in
-
-{
+in {
 
   ###### interface
 
@@ -32,6 +30,8 @@ in
         '';
         description = ''
           Set additional configuration for system-wide bluetooth (/etc/bluetooth/main.conf).
+
+          NOTE: We already include [Policy], so any configuration under the Policy group should come first.
         '';
       };
     };
@@ -45,7 +45,12 @@ in
     environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
 
     environment.etc = singleton {
-      source = pkgs.writeText "main.conf" cfg.extraConfig;
+      source = pkgs.writeText "main.conf" ''
+        [Policy]
+        AutoEnable=${lib.boolToString cfg.powerOnBoot}
+
+        ${cfg.extraConfig}
+      '';
       target = "bluetooth/main.conf";
     };
 
@@ -53,29 +58,11 @@ in
     services.dbus.packages = [ bluez-bluetooth ];
     systemd.packages       = [ bluez-bluetooth ];
 
-    services.udev.extraRules = optionalString cfg.powerOnBoot ''
-      ACTION=="add", KERNEL=="hci[0-9]*", ENV{SYSTEMD_WANTS}="bluetooth-power@%k.service"
-    '';
-
     systemd.services = {
       bluetooth = {
         wantedBy = [ "bluetooth.target" ];
         aliases  = [ "dbus-org.bluez.service" ];
       };
-
-      "bluetooth-power@" = mkIf cfg.powerOnBoot {
-        description = "Power up bluetooth controller";
-        after = [
-          "bluetooth.service"
-          "suspend.target"
-          "sys-subsystem-bluetooth-devices-%i.device"
-        ];
-        wantedBy = [ "suspend.target" ];
-
-        serviceConfig.Type      = "oneshot";
-        serviceConfig.ExecStart = "${pkgs.bluez.out}/bin/hciconfig %i up";
-      };
-
     };
 
     systemd.user.services = {