Skip to content

Question about dependency on "which" #392

Closed

Description

@Lysxia

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.)

Activity

  1. srid commented on Sep 13, 2020

    @srid
    Owner

    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

  2. Lysxia commented on Sep 13, 2020

    @Lysxia
    ContributorAuthor

    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.

  3. srid commented on Sep 14, 2020

    @srid
    Owner

    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).

  4. srid commented on Sep 14, 2020

    @srid
    Owner

    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.

  5. Lysxia commented on Sep 14, 2020

    @Lysxia
    ContributorAuthor

    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.

  6. modified the milestones: 0.8, 1.0 on Sep 19, 2020
  7. added
    discussionForum like question asked; not exactly a feature or a bug.
    on Sep 23, 2020
  8. Lysxia commented on Oct 9, 2020

    @Lysxia
    ContributorAuthor

    Awesome!

  9. srid commented on Oct 9, 2020

    @srid
    Owner

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

    Enough dealing with non-nix requests for me today.

  10. reopened this on Oct 9, 2020
  11. srid commented on Aug 8, 2021

    @srid
    Owner

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

  12. Repository owner locked and limited conversation to collaborators on Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionForum like question asked; not exactly a feature or a bug.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions