4

I'm trying to enable Bluetooth on my GUIX machine, and I do not understand the instructions:

Scheme Procedure: bluetooth-service [#:bluez bluez] [#:auto-enable? #f]

Return a service that runs the bluetoothd daemon, which manages all the Bluetooth devices and provides a number of D-Bus interfaces. When AUTO-ENABLE? is true, the bluetooth controller is powered automatically at boot, which can be useful when using a bluetooth keyboard or mouse.

Users need to be in the lp group to access the D-Bus service.

In particular, I do not understand the [#: part, and thus do not know what to put in my config.scm.

None of the other modifications I've made to config.scm required such 'arguments' for lack of a better word. For example, extra-special-file is described simply as

Scheme Procedure: extra-special-file file target

and contains an example and was thus easy to figure out.

This does not work:

  (services
    (append
      (list (service gnome-desktop-service-type)
            (service bluetooth-service))
      %desktop-services))

reconfigure gives

guix system: error: failed to load 'config.scm':
gnu/services.scm:242:17: In procedure %service-with-default-value:
In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #<procedure bluetooth-service (#:key bluez auto-enable?)>

Apparently the #: is a hash-colon, which is used to define a keyword in Scheme. But that page does not give me enough information to translate the GUIX instructions into something to put in config.scm.

It feels like the GUIX documentation assumes some Scheme knowledge that I do not yet posses, and I do not really know where to start to obtain. An example would be appreciated.

2 Answers 2

4

The method in original answer below has been deprecated since September 2020

Current method is to use the bluetooth-service-type just like most other services. E.g.

  (services
    (append
      (list (service gnome-desktop-service-type)
            (service bluetooth-service-type)
      %desktop-services))

Old answer:

Ah, static-networking-service had an example, which let me understand:

  • I should not have added service in front of bluetooth-service. I don't really understand why, probably because service converts something else into a service, and bluetooth-service is already a service on its own.
  • The square brackets simply mean 'optional' like everywhere else. The #: syntax can just be copied verbatim.

This seems to work so far:

  (services
    (append
      (list (service gnome-desktop-service-type)
            (bluetooth-service #:auto-enable? #t)
      %desktop-services))

At least reconfigure works, so now it should hopefully be possible to start bluetooth.

Edit 1: Some success!

herd status shows bluetooth running, but bluetooth does not yet seem to work. I'm in the lp group and rebooted. Logging in to gnome gives a popup with this error message:

Failed to apply network settings

You might not be able to connect to the Bluetooth network via this machine

Exception

g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.blueman.Mechanism was not provided by any .service files (2)

Edit 2: More success!

blueman-manager could find the headset and could pair with it. But GNOME could somehow not find the bluetooth adapter at all. Nevertheless, I could redirect the sound to the headset using the normal GNOME sound settings.

Unfortunately, it seems not possible to adjust the volume. Neither the GNOME volume control nor the 'hardware' volume dial on the headset can be used to lower the volume. Only the volume controls on the playing application itself (e.g. youtube) will lower the volume.

I'm not sure whether the remaining problems have anything to do with GUIX though.

1
  • FWIW, since a couple of weeks, bluetooth devices do not connect automatically. I have to go to the bluetooth settings, select the device I'd like to use and move the "Connection" slide to the "on" position.
    – BlackShift
    Commented Aug 8, 2022 at 17:36
1

This might just be a simple pointer, but the hash sign is indicative of a lisp keyword, and can be used like in other languages (python springs to mind). The documentation can be found at https://www.gnu.org/software/guile/manual/guile.html#Keywords.

Also, i noticed a gnome-bluetooth package that might be of interest, although i don't run gnome myself so i can't confirm that it will solve your issue (https://guix.gnu.org/packages/gnome-bluetooth-3.34.2/).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .