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

Issue with expand env shell variables #1193

Open
webhive opened this issue Nov 23, 2024 · 1 comment
Open

Issue with expand env shell variables #1193

webhive opened this issue Nov 23, 2024 · 1 comment

Comments

@webhive
Copy link

webhive commented Nov 23, 2024

I am not familiar with nix, so not sure about this is an error or my misconfiguration.
Anyway got an error after this code in my config

  launchd.user.envVariables = {
        PATH = config.environment.systemPath;
  };

It cause this error

  launchctl setenv PATH '$HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin'
                        ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.

After some investigation I got this.

Here we can see '${value}' in single quotes

launchdVariables = mapAttrsToList (name: value: ''
launchctl setenv ${name} '${value}'
'');

It generating the following code on my system

  In /nix/store/xzsjqwz6l61z1pmwbiq00ikmlfgyy7q5-darwin-system-24.05.20241106.c128e44+darwin5.edabc79/activate-user line 375:
  launchctl setenv PATH '$HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin'
                        ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.

  For more information:
    https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...

So after all here is a question - is this an error and there should be double quotes or I got it wring.

@Random936
Copy link

For anyone else struggling with this, I realized in my case this was to do with the following configuration:

  # Path fix for GUI applications.
  launchd.user.envVariables.PATH = config.environment.systemPath;

After commenting this line out, everything appears to have been built successfully.

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

No branches or pull requests

2 participants