Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding systemd.user.*.*.Install.WantedBy #6709

Open
dbeecham opened this issue Mar 26, 2025 · 1 comment
Open

Allow overriding systemd.user.*.*.Install.WantedBy #6709

dbeecham opened this issue Mar 26, 2025 · 1 comment
Assignees

Comments

@dbeecham
Copy link

Description

I have set up gpg-agent.socket, gpg-agent-ssh.socket, gpg-agent-extra.socket, gpg-agent.service and keyboxd.service to all have BindsTo=dev-yubikey.device and After=dev-yubikey.device. I also set up a yubikey.target which Wants all of the sockets and keyboxd, and set up an udev rule to automatically start gpg-agent when I insert my yubikey. This also automatically kills gpg-agent when the yubikey is not inserted.

This helps me immensely, as I have move around between multiple machines constantly, and there are so many cases where gpg-agent will either start automatically as I SSH into a box, or be started automatically when I run git, or anything else on a long list of annoying behaviors.

Currently, the Install.WantedBy field is hard-coded here. A mkDefault in front of [ "sockets.target" ] would make it possible to simply override. That would also not merge the two lists.

Another solution I like is to make the configuration a dependency on DefaultDependencies, as you'd set that if you want to disable autostarting the service anyway.

Install = { WantedBy = mkIf !Unit.DefaultDependencies [ "sockets.target " ]; };
@khaneliman
Copy link
Collaborator

khaneliman commented Mar 31, 2025

Can you override it with a mkForce ? Or does it still merge the lists?

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

No branches or pull requests

5 participants