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

Make dyre cabal-sandbox and stack aware #29

Closed
codygman opened this issue Nov 28, 2015 · 10 comments
Closed

Make dyre cabal-sandbox and stack aware #29

codygman opened this issue Nov 28, 2015 · 10 comments

Comments

@codygman
Copy link
Contributor

It would be helpful if dyre worked with stack and cabal-sandbox by default. I ran into this need when trying to hack around on the Yi editor which uses dyre.

@noughtmare
Copy link
Contributor

noughtmare commented Jun 28, 2016

Do we still need cabal-sandbox awareness? I think cabal has been replaced by stack and therefore should not be used by new projects, so adding cabal-sandbox detection would be unnecessary. Ignore this, it is wrong.

@colonelpanic8
Copy link

Has anyone attempted this?

@colonelpanic8
Copy link

Didn't a04be85 fix this (for stack at the very least)

@noughtmare
Copy link
Contributor

@IvanMalison I don't consider this issue solved by my patch. It just runs the ghc command "inside" the stack environment if a stack.yaml is present. To actually make this cabal sandbox and stack aware one would have to detect a cabal file or a stack project and then run cabal install or stack install respectively.

@colonelpanic8
Copy link

haskell/cabal#4070

would allow an approach to this where we simply take the first executable target to be what we are trying to build. @noughtmare would that satisfy your needs?

@noughtmare
Copy link
Contributor

I don't understand how that would work. I thought of something like doing stack build or cabal build and parsing the output to find the location and name of the produced executable. Then it is possible to just copy the executable to the right location. But I really don't like it as it relies too much on the command line interface of cabal and stack. If something like this were to be implemented it should check if cabal, stack and ghc are installed.

@colonelpanic8
Copy link

https://github.com/yamadapc/stack-run Might be an option here

@Magicloud
Copy link

I think the key is how to know stack is there. How could an application know it was installed by stack, not cabal-install, or binary distribution.
If it knows its dependencies are in stack, is not stack exec ghc enough?

@frasertweedale
Copy link
Collaborator

I'm going to close this. Cabal sandboxes are deprecated and the developers intend to remove support. dyre works fairly well with the newstyle cabal store, with a bit of extra effort. (That reminds me, I probably ought to build those smarts in Dyre itself).

As for Stack, code was merged that purportedly adds stack support. I don't use stack so I haven't tested it, but any issues can be raised as new tickets.

@HotCat
Copy link

HotCat commented Jun 29, 2021

I don't understand how that would work. I thought of something like doing stack build or cabal build and parsing the output to find the location and name of the produced executable. Then it is possible to just copy the executable to the right location. But I really don't like it as it relies too much on the command line interface of cabal and stack. If something like this were to be implemented it should check if cabal, stack and ghc are installed.

By using stack install --local-bin-path,I can specific the produced executable. As of 0.13, xmonad --recompile will look for a custom build script called build. This is what's the build file looks like in my xmonad configuration directory

#!/bin/sh

set -e
stack build :my-xmonad --verbosity error
stack install :my-xmonad --local-bin-path bin/ --verbosity error
mv bin/my-xmonad "$1"

Xmonad will pass the finally expected excutable path to the argument 1 of build script

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

No branches or pull requests

6 participants