`typecheck` shouldn't require network access
Is your enhancement request related to a problem? Please describe.
The typecheck command which is evoked when running haskell-language-server in the command line (so as to make sure that all files work with HLS) currently accesses the network via cabal. This makes it impossible to use with Nix, unless sandbox is disabled. See https://github.com/srid/haskell-flake/issues/21
default-hls-check> Severity: DsError
default-hls-check> Message:
default-hls-check> Error when calling cabal exec -v0 -- ghc --print-libdir
default-hls-check> dieVerbatim: user error (cabal: Couldn't establish HTTP connection. Possible cause: HTTP proxy
default-hls-check> server
default-hls-check> is down.
default-hls-check> )
Describe the solution you'd like
Is there a way to make typecheck work without network access?
Describe alternatives you've considered
Using --option sandbox false in Nix, but this is obviously not a good idea.
Hi, thank you for your bug report!
I don't know what's going wrong here exactly, but at least on my machine I don't require internet access for this command to succeed.
cabal does have an --offline flag. I'm not sure if it would actually help, but it probably can't hurt to add it?
It's hie-bios that is invoking Cabal, not HLS right? HLS knows nothing about Cabal
It is hie-bios's tasks and the offline flag is useless for v2-* commands.
But I am not sure yet what the actual problem here is, like why it suddenly requires Internet.
But I am not sure yet what the actual problem here is, like why it suddenly requires Internet.
cabal-install is a tool to automate Cabal builds by downloading dependencies from Hackage, so this is not surprising to me. A likely reason is that @srid's project uses Nix to provision all the dependencies in the global pkg database, but hie-bios wants to build the dependencies with a different set of flags and for that it needs to download the dist pacakges
My view is that this is the expected behaviour, @srid should get in touch with the hie-bios maintainers if he wants to contribute patches to integrate hie-bios with Nix to somehow avoid these downloads
@srid I think the core problem here is cabal doesn't trust nix installed binaries like build tools, so it's trying to cabal install them.
See https://github.com/haskell/cabal/issues/8434#issuecomment-1230889097 where I try to explain the nix workflow to cabal maintainers.
I think hie-bios only calls out to cabal and isn't responsible for network access.