I’ve had to manually manage this myself after any nixos-rebuild switch
that would change rootless docker config. Typically I’d just systemctl --user restart docker
depending on the state of the service. Why doesn’t the nix config for virtualisation.docker.rootless
restart the systemd service for me after a rebuild?
Trying to do this auto-restart myself, I added to my nix config
system.userActivationScripts = {
dockerRootlessRestart.text = "systemctl --user restart docker.service";
};
but this causes the systemd service, nixos-activation.service
, to fail with error, systemctl
not found. I’m not sure if a service that restarts a service is best practice, but nix does provide a convenient hook with the config for listening to a nixos-rebuild switch
.