Launching program at startup – pnmixer (alsa system tray mixer)

Hi,

I just want ALSA on my computers, no PulseAudio (thus no pavucontrol). It’s alright with me, but not that simple for my family to basically change the master level – I have to admit that launching a terminal and starting alsamixer is not user friendly ^^’!

I thus added pnmixer but it won’t launch automatically at start up, and there doesn’t seem to be any option written for this.

I’ve searched the NixOS manual, but I don’t see how to just do this – do I have to write a custom systemd service? Is it simple to do? Or maybe that’s just a cron job?

Any idea on the best way to do this?
Thanks for reading and all the best,

I’ve struggled a bit further. I’ve found this stackoverflow post and tried this:

systemd.user.services.pnmixer = {
  enable = true;
  description = "ALSA volume mixer for the system tray";
  serviceConfig = {
    ExecStart = "${pkgs.pnmixer}/bin/pnmixer";
  };
  wantedBy = ["multi-user.target"];
};

System is compiling but pnmixer doesn’t launch at startup.
Then I tried to pinpoint one of the latest services via systemctl and to try to launch pnmixer after – I added:

  after = ["user@1000.service"];

Still compiling, still nothing :thinking:.

BTW, I also tried with systemd.services.pnmixer instead of the user version.
No idea how to do this?

I have the same problem. A basic function. I run Gnome but want to have the config.nix do the setting. This is the only seemingly relevant thing I have found but have not tested it yet:
https://github.com/nix-community/home-manager/issues/3447