hLock with cabal run in WSL2

Hi,

I’ve configured a small Haskell project using cabal. Running nix-shell, then cabal run fails with

Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - reports-0.1.0.0 (exe:reports) (first run)
ghc-pkg: {handle: /home/adarcy/code/reports/dist-newstyle/build/x86_64-linux/ghc-9.0.2/reports-0.1.0.0/x/reports/package.conf.inplace/package.cache.lock}: hLock: invalid argument (Invalid argument)

Any idea ? Thanks !

Here is default.nix

let
  pkgs = import <nixpkgs> { };
in
  pkgs.haskellPackages.developPackage {
    root = ./.;
    modifier = drv:
      pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
        [ cabal-install
          text
        ]);
  }

Here’s the cabal configuration

cabal-version:      2.4
name:               reports
version:            0.1.0.0

author:            adarcy
maintainer:         XXX
extra-source-files: CHANGELOG.md

executable reports
    main-is:          Main.hs
    build-depends:    base
                    , time
                    , text
    hs-source-dirs:   app
    default-language: Haskell2010

I’m using Ubuntu in WSL2: Linux B12725 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux.

Update: upgrading to WSL2 fixed it, as mentionned on stack overflow : haskell - ghc-pkg: Couldn't open database for modification: hLock: invalid argument - Stack Overflow