Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Question about dependency on "which" #392

Closed
Lysxia opened this issue Sep 13, 2020 · 8 comments · Fixed by #429
Closed

Question about dependency on "which" #392

Lysxia opened this issue Sep 13, 2020 · 8 comments · Fixed by #429
Labels
discussion Forum like question asked; not exactly a feature or a bug.
Milestone

Comments

@Lysxia
Copy link
Contributor

Lysxia commented Sep 13, 2020

I'm trying to build neuron using plain cabal, instead of via Nix as documented, so I could be missing something. There are a few hacks needed on the way to reproduce the following problem, but basically, if I run cabal install neuron, I get the error that neuron-search could not be found while compiling neuron/src/app/Neuron/CLI/Search.hs.

In neuron/src/app/Neuron/CLI/Search.hs, the function staticWhich from the package "which" is used to find the path to the bash script neuron-search.

neuronSearchScript = $(staticWhich "neuron-search")

I could make it compile using the Paths_neuron module instead, but I'm not sure whether that would work for Nix. Does this look like an acceptable fix?

neuronSearchScript = $(TH.lift (unsafePerformIO (getDataFileName "src-bash/neuron-search")))

Lysxia@51e5eb0#diff-156fa4df5d0d36eccfe427a54b100371R22

(Note: I'm actually using tag 0.6.0.0 instead of master, to avoid rib-core, but the relevant line of code hasn't changed so the issue still seems current.)

@srid
Copy link
Owner

srid commented Sep 13, 2020

May I know the reason for trying to build it with plain cabal, outside of Nix?

Generally speaking, this is best done in the which library. There is a PR open for that, but I don't know the status of it: obsidiansystems/which#3

@Lysxia
Copy link
Contributor Author

Lysxia commented Sep 13, 2020

I don't want to install and learn to use yet another package manager. The required changes to build with vanilla cabal are quite minor; I can volunteer to patch and maintain anything that has to do with this, but I would also understand if you just don't want the extra overhead; this issue is the only one I'm not sure how to fix without breaking stuff.

The linked patch to which doesn't seem it would actually work if the required executable is a data file of the current package, because it depends on that executable being on PATH before the package is built.

@srid
Copy link
Owner

srid commented Sep 14, 2020

Since this is the only place where staticWhich is used (it used to be used in several places), then I suppose we can just get rid of it entirely, and possibly even embed the neuron-search script in haskell (via Text.RawString.QQ).

I don't particularly like seeing unsafePerformIO here (doesn't seem like a conventional solution; is that what all these TH libraries do?).

In any case, whatever change we make should continue to work in nix-build (./result/bin/neuron -d ./guide search should not fail), and should not break the compilation in the bin/run and bin/test scripts (which use ghcid).

@srid
Copy link
Owner

srid commented Sep 14, 2020

Plus, it should not revert the nix install size optimizations done in #193 (comment) (do a nix install on a fresh Ubuntu VM, and check the size of /nix). I vaguely remember seeing an issue with cabal's Paths_neuron adding unnecessary dependencies.

@Lysxia
Copy link
Contributor Author

Lysxia commented Sep 14, 2020

I don't particularly like seeing unsafePerformIO here (doesn't seem like a conventional solution; is that what all these TH libraries do?).

The conventional solution is to use runIO, I didn't remember the name off-hand.

@srid srid modified the milestones: 0.8, 1.0 Sep 19, 2020
@srid srid added the discussion Forum like question asked; not exactly a feature or a bug. label Sep 23, 2020
@srid srid closed this as completed in #429 Oct 9, 2020
@Lysxia
Copy link
Contributor Author

Lysxia commented Oct 9, 2020

Awesome!

@srid
Copy link
Owner

srid commented Oct 9, 2020

Had to revert that. If you're interested, please see #432

Enough dealing with non-nix requests for me today.

@srid srid reopened this Oct 9, 2020
@srid
Copy link
Owner

srid commented Aug 8, 2021

Closing per https://neuron.zettel.page/next ... to further discuss this idea, in the context of Emanote, post here

@srid srid closed this as completed Aug 8, 2021
Repository owner locked and limited conversation to collaborators Aug 8, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
discussion Forum like question asked; not exactly a feature or a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants