IntersectMBO / plutus-apps

The Plutus application platform
Apache License 2.0
306 stars 214 forks source link

nix-build of Plutus Playground fails on Windows with git autocrlf enabled #35

Closed thebrandre closed 1 year ago

thebrandre commented 3 years ago

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:

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:

cd /plutus
nix-build --option substituters "https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/" --option trusted-public-keys "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option use-sqlite-wal false --show-trace

This fails with the following output:

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).

ghost commented 1 year ago

Closing as we have dropped the support of Plutus Playground.