Summary:
The nix-build of Plutus Playground with both Windows Subsystem for Linux (wsl) and inside a Docker container fails if you previously have cloned Plutus with the common default git config core.autocrlf=true on Windows.
Possible solution:
One might disable autocrlf in the whole project. This is, for example, what vcpkg does here.
This issue is relevant because:
Using wsl is quite common these days and this issue is very hard to track down.
Diagnostic info:
I was using the:
[x] Plutus Playground
[ ] Marlowe Playground
Link to gist with saved setup that reproduces the issue:
If you clone the repository with core.autocrlf=true on Windows (usually the default) and try to build inside a Docker container:
git config --global core.autocrlf
git clone https://github.com/input-output-hk/plutus.git
cd plutus
docker run -it --rm -v "${PWD}:/plutus" nixos/nix
Inside the container, I ran the following commands:
unpacking 'https://github.com/NixOS/nixpkgs/archive/7d71001b796340b219d1bfa8552c81995017544a.tar.gz'...
unpacking 'https://github.com/input-output-hk/haskell.nix/archive/99fdad764061f4166e4c0d1d8783bd039c7bb851.tar.gz'...
unpacking 'https://github.com/input-output-hk/iohk-nix/archive/9dd0d1d10ae187df885996b85c9cb4f6990dae86.tar.gz'...
error: while evaluating the attribute 'packages.marlowe.components.exes' at /plutus/nix/pkgs/haskell/default.nix:63:11:
while evaluating the attribute 'hsPkgs' at /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.while evaluating the attribute 'hsPkgs' at /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.nix:516:43:
while evaluating 'mkCabalProjectPkgSet' at /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.nix:152:13, called from /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.nix:501:30:
while evaluating the attribute 'buildPackages.haskell-nix.compiler."${(((plan-pkgs).pkgs hackage)).compiler.nix-name}".version' at /nix/store/qrbp0y6mfscqhfhzivnhc91hvby45nv7-nixpkgs-src/lib/attrsets.nix:344:7:
while evaluating anonymous function at /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/lib/import-and-filter-project.nix:5:1, called from /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.nix:503:31:
while evaluating anonymous function at /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/lib/call-cabal-project-to-nix.nix:9:1, called from /nix/store/cf4ksa58yibwkmx2z83y7qd9zwpyjwmy-haskell.nix-src/overlays/haskell.nix:500:36:
Index state found was 2021-02-24T00:00:00Z and no index-sha256 was provided.
But it works once I set "core.autocrlf=false" or clone inside the container.
I am referring to the Docker container nixos/nix (digest "a6bcef50c7ca82ca66965935a848c8c388beb78c9a5de3e3b3d4ea298c95c708") for reproducibility but the same thing happens with Windows Subsystem for Linux (wsl). With wsl you can "accidentally" fix it by cloning inside wsl (autocrlf will checkout Linux line endings).
Summary: The nix-build of Plutus Playground with both Windows Subsystem for Linux (wsl) and inside a Docker container fails if you previously have cloned Plutus with the common default
git config core.autocrlf=true
on Windows.Possible solution: One might disable autocrlf in the whole project. This is, for example, what vcpkg does here.
This issue is relevant because: Using wsl is quite common these days and this issue is very hard to track down.
Diagnostic info:
If you clone the repository with core.autocrlf=true on Windows (usually the default) and try to build inside a Docker container:
Inside the container, I ran the following commands:
This fails with the following output:
But it works once I set "core.autocrlf=false" or clone inside the container. I am referring to the Docker container nixos/nix (digest "a6bcef50c7ca82ca66965935a848c8c388beb78c9a5de3e3b3d4ea298c95c708") for reproducibility but the same thing happens with Windows Subsystem for Linux (wsl). With wsl you can "accidentally" fix it by cloning inside wsl (autocrlf will checkout Linux line endings).