Skip to content

Conversation

@kaiba42
Copy link

@kaiba42 kaiba42 commented May 7, 2023

Fixes #580. This appears to be another instance of the underlying issue causing #558 and #396.

"This fixes an infinite recursion error that originated as a result of trying to set an environment variable using the output of another environment variable." - @anoadragon453

Fixes cachix#580. This appears to be another instance of the underlying issue causing cachix#558 and cachix#396.

"This fixes an infinite recursion error that originated as a result of trying to set an environment variable using the output of another environment variable." - @anoadragon453
@anoadragon453
Copy link
Contributor

anoadragon453 commented May 7, 2023

Heads up that @bobvanderlinden left a note at 75b18d2#r111783708 mentioning that this should probably be set in enterShell instead of via env, as otherwise this solution relies on the DEVENV_PROFILE environment variable being properly set in the user's shell at all times.

I plan to tweak the solution in #559 to do the same.

@bobvanderlinden
Copy link
Contributor

bobvanderlinden commented May 7, 2023

Thanks for the heads-up! The PR that fixed the earlier issue is here for Python: #573

See that PR also for the ability to add tests in examples using .test.sh. This can be used to avoid regressions in the future.

@anoadragon453
Copy link
Contributor

@bobvanderlinden Oh, I hadn't seen that. Thank you for doing that!

@domenkozar
Copy link
Member

Did anyone test if this works?

@averagechris
Copy link
Contributor

I worked around this on macOS via

      env =
        {}
        // lib.mkIf pkgs.stdenv.isDarwin {
          RUSTFLAGS = lib.mkForce ["-L framework=$DEVENV_PROFILE/Library/Frameworks"];
          RUSTDOCFLAGS = lib.mkForce ["-L framework=$DEVENV_PROFILE/Library/Frameworks"];
          CFLAGS = lib.mkForce ["-iframework $DEVENV_PROFILE/Library/Frameworks"];
        };

which is equivalent to this PR.

@bobvanderlinden
Copy link
Contributor

I think this will never work with the current implementation. Using $DEVENV_PROFILE inside env.* will not be expanded (or has that been changed in the meantime?). Adding it to enterShell does work.
Best would be to add a test, so that these kinds of problems won't pop up again and it is clear for others how to replicate them.

@averagechris
Copy link
Contributor

@bobvanderlinden thanks you are absolutely correct. I'll open up a PR that mimics your solution for python. Thank you!

@domenkozar
Copy link
Member

This one won't fix it, there's a new PR and I'm testing a more general fix.

@domenkozar domenkozar closed this Jul 8, 2023
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.

Infinite recursion error on macOS for Rust language and processes config

5 participants