commercialhaskell / stackage-server

Server for stable, curated Haskell package sets
MIT License
106 stars 27 forks source link

Add GHC resolver endpoint, ghc-x.y.z/cabal.config? #322

Open philderbeast opened 10 months ago

philderbeast commented 10 months ago

In the Stack docs, it says we can use resolver: ghc-x.y.z.

  • LTS Haskell snapshots, e.g. resolver: lts-21.13
  • Stackage Nightly snapshots, e.g. resolver: nightly-2023-09-24
  • No snapshot, just use packages shipped with the compiler. For GHC this looks like resolver: ghc-9.6.2

SOURCE: resolver or snapshot

I can get a cabal.config file for LTS and nightly resolvers. Could we provide a cabal.config for ghc-x.y.z resolvers too? If so then I'd expect it would show packages shipped with the compiler.

$ curl https://www.stackage.org/lts-21.22/cabal.config --silent | sed -n 1,8p
-- NOTE: Due to revisions, this file may not work. See:
-- https://github.com/fpco/stackage-server/issues/232

-- Stackage snapshot from: http://www.stackage.org/snapshot/lts-21.22
-- Please place this file next to your .cabal file as cabal.config
-- To only use tested packages, uncomment the following line:
-- remote-repo: stackage-lts-21.22:http://www.stackage.org/lts-21.22
with-compiler: ghc-9.4.8
$ curl https://www.stackage.org/nightly-2023-11-28/cabal.config --silent | sed -n 1,8p
-- NOTE: Due to revisions, this file may not work. See:
-- https://github.com/fpco/stackage-server/issues/232

-- Stackage snapshot from: http://www.stackage.org/snapshot/nightly-2023-11-28
-- Please place this file next to your .cabal file as cabal.config
-- To only use tested packages, uncomment the following line:
-- remote-repo: stackage-nightly-2023-11-28:http://www.stackage.org/nightly-2023-11-28
with-compiler: ghc-9.6.3
$ curl https://www.stackage.org/ghc-9.4.8/cabal.config --silent
<!doctype html>
<html>
...
<div class="container"><h1>Not Found</h1>
<p>/ghc-9.4.8/cabal.config</p>
</div>
...</html>⏎
chreekat commented 5 months ago

In principle I don't see why not. But the info needs to come from GHC somehow.

The snapshot config files are generated on the fly: https://github.com/commercialhaskell/stackage-server/blob/master/src/Handler/StackageHome.hs#L66

chreekat commented 5 months ago

I discovered that https://github.com/commercialhaskell/stackage-content/blob/master/stack/global-hints.yaml exists, but it's not made available over HTTP anywhere.

(It's used by stackage-server-cron, which reads the file off the filesystem.)