Skip to content

Instantly share code, notes, and snippets.

@afreakk
Last active January 13, 2022 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afreakk/1df21c564be3250579b8ed27dda10ad7 to your computer and use it in GitHub Desktop.
Save afreakk/1df21c564be3250579b8ed27dda10ad7 to your computer and use it in GitHub Desktop.
{ config, pkgs, ... }:
let
busName = "nvidia.powerd.server";
userName = "messagebus";
nvidiaBlackHole = pkgs.writeTextFile {
name = "nvidiaBlackHole";
destination = "/etc/dbus-1/system.d/nvidia-fake-powerd.conf";
text = ''
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="${userName}">
<allow own="${busName}"/>
</policy>
<policy context="default">
<allow send_destination="${busName}"/>
<allow receive_sender="${busName}"/>
</policy>
</busconfig>
'';};
in
{
services.dbus.packages = [nvidiaBlackHole];
systemd.services.nvidiaBlackHole = {
wantedBy = [ "default.target" ];
aliases = ["dbus-nvidia.fake-powerd.service"];
serviceConfig = {
Type = "dbus";
BusName = busName;
ExecStart = "${pkgs.dbus}/bin/dbus-test-tool black-hole --system --name=${busName}";
User = userName;
Group = userName;
LimitNPROC=2;
ProtectHome=true;
ProtectSystem="full";
};
};
}
@danyeet
Copy link

danyeet commented Jan 13, 2022

That doesn't seem to fix it for me - that said the new beta driver should be merged soon.

@afreakk
Copy link
Author

afreakk commented Jan 13, 2022

@danyeet did you reboot after activating ?
I had to reboot after activating for the service to eat up the dbus spam.
But cool to know coming soon NixOS/nixpkgs#154660

@danyeet
Copy link

danyeet commented Jan 13, 2022

Yup when I run dbus-montior it still gets bombarded with messages.

@afreakk
Copy link
Author

afreakk commented Jan 13, 2022

@danyeet
Ah, yeah, I dont think this service was supposed to fix that.
Only keep it from spamming journald with errors.
I also get spam from sudo dbus-monitor --system

@danyeet
Copy link

danyeet commented Jan 13, 2022

Ah I see - well I misunderstood the assignment haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment