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

Improve packaging support for staticWhich usage #4

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

matthewbauer
Copy link
Collaborator

We do not always know at build-time where we will get an executable.
For instance, on Nix-less systems, the Nix store will be unavailable
and we need to get it some other way. We could hardcode
/usr/local/bin/ to PATH so that GHC will find it, but this introduces
unnecessary impurities and requires changing hashes between builds. As
a workaround, just use classic “which” functionality.

HOST_PATH is set in Nixpkgs during cross-compilation to detect
binaries available at runtime. It makes sure you get the right
architecture in your cross-compiled binaries. When HOST_PATH is not
set, fall back to PATH.
findExecutablesInDirectories was only added in 1.2.4.0.
We do not always know at build-time where we will get an executable.
For instance, on Nix-less systems, the Nix store will be unavailable
and we need to get it some other way. We could hardcode
/usr/local/bin/ to PATH so that GHC will find it, but this introduces
unnecessary impurities and requires changing hashes between builds. As
a workaround, just use classic “which” functionality.
@matthewbauer matthewbauer changed the title Allow packaging which [WIP] Allow packaging which Nov 21, 2019
@matthewbauer matthewbauer changed the title [WIP] Allow packaging which Improve packaging support for staticWhich usage Jun 2, 2020
exists <- doesFileExist f'

-- If it does, run it, otherwise fallback to classic which.
if exists then pure f'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also check if it's executable?

Do we really want "hello" to map to ./hello and not a hello that's on your PATH?

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.

None yet

2 participants