Skip to content

typecheck shouldn't require network access #3128

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

Open
srid opened this issue Aug 28, 2022 · 7 comments
Open

typecheck shouldn't require network access #3128

srid opened this issue Aug 28, 2022 · 7 comments
Labels
component: hie-bios os: nixos status: blocked Not actionable, because blocked by upstream/GHC etc. type: enhancement New feature or request

Comments

@srid
Copy link
Contributor

srid commented Aug 28, 2022

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 srid/haskell-flake#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.

@fendor
Copy link
Collaborator

fendor commented Aug 30, 2022

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.

@michaelpj
Copy link
Collaborator

cabal does have an --offline flag. I'm not sure if it would actually help, but it probably can't hurt to add it?

@pepeiborra
Copy link
Collaborator

It's hie-bios that is invoking Cabal, not HLS right? HLS knows nothing about Cabal

@fendor
Copy link
Collaborator

fendor commented Aug 30, 2022

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.

@pepeiborra
Copy link
Collaborator

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

@pepeiborra
Copy link
Collaborator

pepeiborra commented Aug 30, 2022

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

@ParetoOptimalDev
Copy link

@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 haskell/cabal#8434 (comment) 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.

@Ailrun Ailrun added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hie-bios os: nixos status: blocked Not actionable, because blocked by upstream/GHC etc. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants