I created an issue because I couldn’t make any HTTP requests from Haskell code even though other programming languages don’t have any problems on my NixOS machine. When I tried this on my MacOS and Arch installations everything worked. So it seems like this problem is specific to NixOS. I don’t know what Haskell HTTP client libraries do that’s so different from the likes of
curl that it causes all requests to hang and eventually abort with
ConnectionTimeout but maybe someone has an idea.
This is the example repo you can just clone and then build and run.
This could be related https://github.com/NixOS/nixpkgs/issues/87221
Turns out that this is very likely the reason I can’t use Dhall on NixOS since all downloads fail with
Hm things started working again from one program run to the other. I have no idea what it was and I’m sure it’ll come back but whatever
Nope, still broken
I’m starting to suspect that this is also why it’s impossible for me on NixOS to use Dhall, since the Prelude always returns
ConnectionTimeout. Now that I recognize this error and I know that Dhall is written in Haskell I suspect that something about all Haskell HTTP clients is fundamentally broken on my machine
I have checked your example repository and it works for me.
Is the machine you are trying that code from perhaps behind a proxy and the nix built binaries do not catch the configuration properly? Some personal firewall or other “internet security” software that for some reason considers your haskell application a “bad player”?
Not that I am aware of. Here’s my
configuration.nix, I tried with and without custom name servers.
Sometimes it works, most of the time it doesn’t. If it works once, it then keeps working again for a while. Meaning sometimes the first request takes a long time. If it succeeds though, all other requests are then super quick, just like
Here’s my WIFI adapter. The router is standard, from my German ISP (Telekom).
I’d like to reiterate that this only affects Haskell, no other language has these issues. I have no idea what Haskell HTTP clients do that no one else does.
I’d have to run more tests but right now it seems that
sudo termshark before making any request reliably fixes the issue. The first request still takes long but at least it works. Now I’m wondering if
termshark somehow interacts with my Wifi adapter in a way that… activates it? and makes it succeed with the requests.
Yup, if I start
sudo termshark then Haskell network requests work just fine. I don’t know what to throw out first, Haskell, the WIFI adapter, NixOS, or all together at the same time.
Sorry but this is so frustrating