hello, I'm trying to disable a bluez plugin by appending an extra option for the execStart command for bluetooth.service
, what would be correct way to do this?
I've tried something along the lines of:
systemd.user.services.bluetooth = {
description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
ExecStart = "${pkgs.bluez}/libexec/bluetooth/bluetoothd --noplugin=avrcp";
};
wantedBy = [ "bluetooth.target" ];
};
but after a rebuild & restart, content of /etc/systemd/system/bluetooth.service
still stayed the same.
on non-nix systems I am able to do this via systemctl edit --full bluetooth.service
and edit the unit files directly,
any examples is appreciated!
- system: `"x86_64-linux"`
- host os: `Linux 5.1.11, NixOS, 19.09pre183392.83ba5afcc96 (Loris)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.2.2`
- channels(michael): `"home-manager"`
- channels(root): `"nixos-19.09pre183392.83ba5afcc96, nixos-hardware"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
We use systemd overrides for serviceConfig
. If the service already has an ExecStart
field, you need to clear it first, as per systemd.unit(5)
.
In Nix, you can achieve that by using a list
…
systemd.user.services.bluetooth.serviceConfig.ExecStart = [
""
"${pkgs.bluez}/libexec/bluetooth/bluetoothd --noplugin=avrcp"
];
…
which will result in the expected override.conf
file:
…
ExecStart=
ExecStart=/nix/store/…/libexec/bluetooth/bluetoothd --noplugin=avrcp
…
This sadly doesn't work for me, I keep running into either already define
or infinite recursion errors as explained here:
https://stackoverflow.com/questions/50678639/how-to-change-the-serviceconfig-of-a-service-defined-in-nixpkgs-from-configuratiThere's also this PR that fixes this: #41446 but I'm stuck whilst waiting
for this to be released..
bluetooth is not a user service - it's a system service, so any kind of overrides should happen on systemd.services.bluetooth
and not systemd.user.services.bluetooth
.
Hi,
I deleted my comment since I managed to work around it, see here https://github.com/NixOS/nixpkgs/pull/41446
Thans for your quick reply!
Most helpful comment
We use systemd overrides for
serviceConfig
. If the service already has anExecStart
field, you need to clear it first, as persystemd.unit(5)
.In Nix, you can achieve that by using a list
which will result in the expected
override.conf
file: