Blog of Juuso Haavisto

182 words

Apple Music on Linux using Pipewire

Streaming DRM music to Linux from an iPhone

Moving to a Linux laptop from the Apple ecosystem is not without its hurdles: one of the amenities lost is DRM music playback.

However, sticking to your iPhone makes the transition a bit easier. This is because Pipewire supports high quality audio streaming from the iPhone over Bluetooth. Here, Pipewire acts as Bluetooth receiver. Coincidentally, if you happen to also own AirPods, you can use these for microphone.

Using NixOS, the configuration is as follows:

  1. Enable Bluetooth: hardware.bluetooth.enable = true;
  2. Enable Pipewire:
services.pipewire = {
  enable = true;
  alsa.enable = true;
  alsa.support32Bit = true;
  pulse.enable = true;
};
  1. (Optional) Enable newer protocols for more features:
environment.etc = {
  "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
    bluez_monitor.properties = {
      ["bluez5.enable-sbc-xq"] = true,
      ["bluez5.enable-msbc"] = true,
      ["bluez5.enable-hw-volume"] = true,
      ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
    }
  '';
};
  1. Apply configuration (with Flake support): sudo nixos-rebuild test --flake .
  2. Pair iPhone with Bluetooth:
bluetoothctl
[bluetooth]# scan on
# (wait for device to appear)
[bluetooth]# connect AC:....

Now, open Apple Music, and start listening!