Plutus Example Project - Nix-shell issue - MacOS Big Sur

I managed to have this issue sorted out. It’s probably going to go away as the new stable version of Nix will be released working with this version of Big Sur. But for the sake of people who may encounter it, here is one solution.

  1. The first problem was, that I’ve set up Sandboxing for Nix on Mac according this. I shouldn’t have had. It doesn’t work on Big Sur 11.2.2

  2. After this if you try to run nix-shell it fails with another problem. It tries to build ghc 8.10.2, but it fails as it won’t find the libcache.dylib and cannot link the respective symbols. It is also a side-effect of Big Sur 11.2.2 and this version of nixpkgs (20.09). To resolve this you need to use a newer (unstable) build of nixpkgs where this has been fixed. To do that here is one way to do it (I’m definitely not a Nix pro, so probably there are better ways to do this. This at least worked for me):

  • Add an unstable nix channel by following this
  • Update shell.nix for the example contract to use that and do not fetch 20.09. I couldn’t find a tarball for the unstable version, so I went with this solution for shell.nix:
{ nixpkgs ? import <unstable> {} }:
let runtimeGhc = nixpkgs.haskell.packages.ghc8102.ghcWithPackages (ps: with ps; [ zlib ]);
in
with nixpkgs; mkShell {
  buildInputs = [
    runtimeGhc
    cabal-install
    stack
    wget
    curl
    binutils
    git
    vim
    openssl.dev
  ];
}
1 Like