I am trying to get something to run as soon as possible via a systemd service.
I have tried roughly the following in my configuration:
systemd.services.gpu-thing = {
description = "Mess with the gpu early on boot";
before = [ "basic.target" ];
script = ''
echo smash
echo smash | systemd-cat
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutStartSec = 300;
};
};
But I just cannot seem to get it to run at all. systemctl status gpu-thing
stays it is loaded and enabled but it shows that it has not run. Nothing shows up in the various logs. I have looked at various other service declarations in the nix repo and I feel mine is similar enough. I am basically trying to get something to run when this driverctl tool runs in other distros. I just need to do a little fiddling with the gpu as early as possible to aid with some gpu passthough things. What am I missing here?
When my system is running if I do systemctl start gpu-thing
then I can see it has done stuff both via systemctl status
and journalctl
. So I can get it running afterwards manually (and far too late) but it doesn’t run when it should.