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

services.nix-daemon.environmentVariables #993

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lrworth
Copy link

@lrworth lrworth commented Jul 3, 2024

a9e0f71 made it possible to modify the environment passed to nix-daemon. This turns out to also be useful for other things, so let's make it a little more idiomatic and document it.

The new `services.nix-daemon.environmentVariables` seems more idiomatic
so let's gracefully deprecate `config.nix.envVars` (which was only ever
used here).
@emilazy
Copy link
Collaborator

emilazy commented Jul 8, 2024

Thanks for the contribution! The current behaviour matches NixOS, so I’m a little worried about introducing divergence with their module. Maybe it’d be a good idea to get this upstream in NixOS too so we can minimize the differences and users can share their configuration? On the other hand I don’t want to double your work. Does setting launchd.daemons.nix-daemon.serviceConfig.EnvironmentVariables work currently? That at least signals that the same option won’t work on NixOS too.

@lrworth
Copy link
Author

lrworth commented Jul 9, 2024

As far as I can tell, config.nix.envVars is not documented in NixOS either so perhaps upstreaming this change is a good idea; but I don't have a NixOS machine to test with, nor time to set one up.

Does setting launchd.daemons.nix-daemon.serviceConfig.EnvironmentVariables work currently?

I'm not sure what you are asking. That field is already used to configure the environment variables in /Library/LaunchDaemons/org.nixos.nix-daemon.plist.

@emilazy
Copy link
Collaborator

emilazy commented Jul 9, 2024

Totally understood re: NixOS. I’ll try to find the time to raise it there, but I suspect the answer would be “just use the systemd.* settings”, which is why I brought up launchd.*.

I'm not sure what you are asking. That field is already used to configure the environment variables in /Library/LaunchDaemons/org.nixos.nix-daemon.plist.

Ah, the difference is that nix.nixVars also gets added to your shell environment. I assumed that the idea of this option was for things that you wanted the daemon and your user to have separate values for, which is why I suggested setting them directly in the launchd.* options.

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

Successfully merging this pull request may close these issues.

2 participants