Repository navigation
Closed
Labels
cabal-install: source-repository-packagecabal-install: v2-build systemAffecting v2-build and related commands that use v2-architecture (aka "nix local builds").priority: lowtype: enhancement
Milestone
Description
Summary by @ezyang:
- Syntactic support for these URLs exists: in the
packagesfield you can specify remote tarballs or local tarballs, and using thesource-repositorysyntax (from Cabal file) you can point to a VCS URL (this parser should also have been reused forcabal.project) - Support for downloading from various places exists. There's support in the old-build path for local/remote tarballs.
cabal get -ssupports getting things from source repositories. - However, these are not used for anything: the internals need to be plumbed up to use this. Look at old stuff and determine how to port it over.
This should be doable in a day.
This came up on Twitter:
Basically, people want to publish packages that depend on stuff that is not on Hackage. One solution is to upload a forked package (example), but this has its own downsides (Hackage namespace becomes polluted). Implementing something like build-depends: https://repo.git@revision would be a nice alternative. Most other package managers (e.g. sbt) support this.
It should also be possible to prohibit downloading packages not on Hackage via a config file option.
See also #1534.
Reacted by Federico Stra
Metadata
Metadata
Assignees
Labels
cabal-install: source-repository-packagecabal-install: v2-build systemAffecting v2-build and related commands that use v2-architecture (aka "nix local builds").priority: lowtype: enhancement
Activity
mietek commentedon Nov 11, 2014
Halcyon supports declaring sandbox sources with the
HALCYON_SANDBOX_SOURCESoption.See Try Haskell for an example of declaring the git
HEADversion of mueval as a sandbox source.winterland1989 commentedon Jul 11, 2016
I'd like to bump this issue's priority and start to discuss implementation, currently it's stopping us using cabal in company environment because we have multiple packages can't be upload to hackage, and a hackage mirror is an overkill. now we use stack to solve this headache, but it's really not necessary to rely both on hackage and stackage infrastructure.
ezyang commentedon Jul 11, 2016
Hello @winterland1989. Have you tried the new new-build functionality (http://blog.ezyang.com/2016/05/announcing-cabal-new-build-nix-style-local-builds/). If you have all of the non-Hackagable packages on disk in a build tree, you can write a cabal.project to pick them up, and then
cabal new-buildwill automatically build them together. Does that solve your proximal problem?winterland1989 commentedon Jul 11, 2016
Thanks for your reply @ezyang ! I'm aware that there're multiple ways solving local package discovery:
cabal sandbox add-sourceor acabal.projectfile both solve this, and i'm aware thatcabal.projectfile support parsing URI as package now. But we need an automatic way to pull/update the remote file into disk without hassle, currently available options aregit submodule, hand-role shell and stack.(you really want to automate this process when you got more than 5 local depends).If
cabal.projectfile is the final solution, i'll dig into it to see what i can do.23Skidoo commentedon Jul 11, 2016
@winterland1989
There is already some code for declaring VCS dependencies in
cabal.projectfiles: https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/ProjectConfig.hs#L523If you want to contribute code to Cabal, I suggest improving the nix-local-build code path, since the plan is to make it the default in the future.
alanz commentedon Jul 11, 2016
I would like to see something like http://docs.haskellstack.org/en/stable/yaml_configuration/#complex-package-locations-location
phadej commentedon Jul 13, 2016
Looks like we only need to teach
cabal-installhow to fetch stuff from the internet:cabal/cabal-install/Distribution/Client/ProjectConfig.hs
Line 745 in 5423d77
tarsupport shouldn't be difficult, as cabal handles it already.gitis trickier, as we need to teachcabal-installto callgit clone(anddarcs).Question: were to put downloaded stuff,
dist-newstyle/downloaded/hash-of-the-source?phadej commentedon Jul 13, 2016
(For now one can use
git submodule, effectively the result should be the same)alanz commentedon Jul 13, 2016
FYI, every github commit can be downloaded as a zip file, e.g.
https://github.com/haskell/cabal/archive/master.zip
https://github.com/haskell/cabal/archive/59eabde01e7df7ac51602b40d867fe5ece2992c2.zip
winterland1989 commentedon Jul 13, 2016
Yes, but that's github's convention, we probably shouldn't rely on that convention. In fact we can safely assume user have
gitbinary installed if they want to use git depends, and we can useprocesspackage managegit clone/pull.alanz commentedon Jul 13, 2016
A use case for this is during development when another client component has not yet been released to hackage. E.g. ghc-mod for HaRe. This is a temporary state.
Having a temporary config in a cabal.project is a lot more lightweight than adding a git submodule.
7 remaining items
23Skidoo commentedon Sep 8, 2016
We can ask git if the source has been fiddled with and then fall back to treating it like a local dir if it is the case.
ezyang commentedon Sep 8, 2016
I'm inclined to just not allow specification of a hash if you don't specify a remote URL. Don't really want new-build to be checking out git branches or ignoring my hash...
bitemyapp commentedon Oct 28, 2016
I'm looking forward to celebrating this issue's second 🎂 in two days.
bitemyapp commentedon Oct 30, 2017
Happy 🎂!
gbaz commentedon Mar 24, 2018
The provenance-qualified imports proposal (ghc-proposals/ghc-proposals#115) is relevant here.
hvr commentedon Jul 14, 2018
It's a pity @bitemyapp won't get to celebrate schadenfreude this year... ;-)
typedrat commentedon Jul 15, 2018
Closed by #5351.
nomeata commentedon Jul 18, 2018
Exciting! I want to play with this
But is this really fixed? https://github.com/haskell/cabal/blob/master/Cabal/doc/nix-local-build.rst on master still says
and
typedrat commentedon Jul 18, 2018
That's a documentation bug, I believe.
nomeata commentedon Jul 18, 2018
I will know in a few minutes when
cabalhas built and I can try the feature :-)…
Yes, seems to work. Great!