ghc.nix
ghc.nix copied to clipboard
Add a flag for disabling tests for time-compat
WSL2 has an annoying bug where clock_getres
returns a resolution of 1ns, but the actual clock resolution is 100ns. https://github.com/microsoft/WSL/issues/6029 https://github.com/haskell/time/issues/136
Because of this, building time-compat results in a failure:
resolution
getCurrentTime: FAIL (0.14s)
test/main/Test/Clock/Resolution.hs:44:
resolution
expected: 0.000000001s
but got: 0.0000001s
taiClock: FAIL (0.14s)
test/main/Test/Clock/Resolution.hs:44:
resolution
expected: 0.000000001s
but got: 0.0000001s
This PR adds fixWSL2
flag that disables time-compat
tests. I'm pretty sure overriding time-compat
like this means that package caches can't be used anymore and all of the dependencies will have to be recompiled, so this flag is disabled by default. Annoying, but better than not building at all!
Have you tried the workaround suggested by @tritlo in https://github.com/haskell/time/issues/136#issuecomment-843600385?
No, I haven't. I actually didn't see that comment (I did implement this fix in back March, only now decided to make it into MR).
Yeah, that seems to work, installing cachix required some changes in system configuration though which is annoying. Not sure if that was NixOS specific.
I am also trying to use time-compat
via Nix on WSL, and I am running into the same clock resolution test failures.
I've tried building both normally and with cachix use ghc-nix
, and neither has worked so far.
Hey @AlexKnauth ,
I've tried building both normally and with
cachix use ghc-nix
, and neither has worked so far.
So, does this PR solve the issue on your machine? (I'm a bit unsure about how to interpret the word normally.)
Your input would be very valuable, as I don't have access to any Windows machine...
How should I supply the new fixWSL2
flag when building this?