Hey Guys,
I was trying to set up a Plutus example project locally on my Mac following this:
https://github.com/input-output-hk/plutus/blob/master/example/README.md
Configuration:
- MacOS Big Sur 11.2.2
- Nix 2.3.10
- IOHK binary cache added to
nix.conf
- Plutus-Core built successfully
After trying to start nix-shell
the following error occurs:
these derivations will be built:
/nix/store/2grsr21ij9nffkk74cqpkf0h4sinnwm2-hscolour-1.24.4.drv
/nix/store/78iixzimzwapfxn34nklrjjwrqjjhl2q-zlib-0.6.2.2.drv
/nix/store/4sdy84iybdpyk23iias6lwcrhfk87djq-ghc-8.10.2-with-packages.drv
error: while setting up the build environment: getting attributes of path ‘/usr/lib/libSystem.B.dylib’: No such file or directory
Does anyone know perhaps how to fix this?
It looks like a build issue specific to Big Sur and Nix. The help I could find so far is this but that’s too generic and since I’m kind of new to Nix I’m not sure how to follow through with that.
Thanks.
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.
-
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
-
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
I’m a little bit uncertain about how to apply the shell.nix script you are referring to.
I have tried adding it to the end of the original shell.nix script in the Plutus directory but I get a syntax error.
error: syntax error, unexpected '?', expecting '.' or '=', at /Users/bob/Documents/personal/plutus/plutus/shell.nix:119:11
Any ideas?
Thanks in advance.