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
Idris: Wrap with IDRIS_CC #42855
Idris: Wrap with IDRIS_CC #42855
Conversation
Previously idris used the C compiler from PATH for the C backend, which means that the results and whether it even succeeds can vary between systems (e.g. if a Nix-built Idris was used on a super old Linux system, the cc installed there might not even work for Idris' C). To make this more predictable, this commit sets the IDRIS_CC env var, which Idris will prefer over searching in PATH, to a Nix-provided gcc executable, given that it is not already set, so it's still possible to override.
No attempt on aarch64-linux (full log) The following builds were skipped because they don't evaluate on aarch64-linux: idris Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: idris Partial log (click to expand)
|
--suffix LIBRARY_PATH : ${stdenv.lib.makeLibraryPath lib} | ||
''; | ||
} | ||
--run 'export IDRIS_CC=''${IDRIS_CC:-${lib.getBin gcc}/bin/gcc}' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use makeWrapper
's --set
parameter here? See:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh#L16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not, --set
really sets it equal to exactly the string you give it, can't expand any variables (it uses bash's ${parameter@operator}
"Parameter transformation" with operator=Q, see man bash
). --run
is the next best way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. All good then.
Thanks @infinisil this is great for reproducibility and customizability. |
Good to merge. |
Motivation for this change
Previously idris used the C compiler from PATH for the C backend, which
means that the results and whether it even succeeds can vary between
systems (e.g. if a Nix-built Idris was used on a super old Linux system,
the cc installed there might not even work for Idris' C).
To make this more predictable, this commit sets the IDRIS_CC env var,
which Idris will prefer over searching in PATH, to a Nix-provided gcc
executable, given that it is not already set, so it's still possible to
override.
This closes #42785
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)