MacOS Monterey, Apple M1
Installed latest GHC via https://www.haskell.org/ghcup/ but not Stack.
Installed nix 2.8.0 multiuser Set Cache in /etc/nix/nix.conf as below: UPDATE: I have since updated nix.conf file for M1. See bottom of question for latest nix.conf and corresponding error message
sandbox = false
substituters = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
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=
Steps to reproduce:
git clone https://github.com/input-output-hk/plutus-starter
cd plutus-starter
nix-shell
Result: Note see Update below. This might have been due to nix.conf not setup properly for M1.
> Configuring mtl-2.2.2...
> "/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg" update -v0 --force --package-db=libraries/bootstrapping.conf libraries/mtl/dist-boot/inplace-pkg-config
> "inplace/bin/ghc-cabal" configure libraries/hpc dist-boot --with-ghc="/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc" --with-ghc-pkg="/nix/store/jjjbvzpal4b7n6hmnychrq07w36jnzjw-ghc-8.10.7/bin/ghc-pkg" --package-db=/private/tmp/nix-build-ghc-8.8.4.drv-1/ghc-8.8.4-configured-src/libraries/bootstrapping.conf --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --disable-library-profiling --disable-shared --with-hscolour="/nix/store/v35zbnmxnxh1axccw5agmplam8nbr0b8-hscolour-exe-HsColour-1.24.4/bin/HsColour" --configure-option=CFLAGS="-Wall -Wno-unknown-pragmas" --configure-option=LDFLAGS=" " --configure-option=CPPFLAGS=" " --gcc-options="-Wall -Wno-unknown-pragmas " --configure-option=--with-iconv-includes="/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/include" --configure-option=--with-iconv-libraries="/nix/store/cg81y8mlrvd3crly089xy6xd63nvzm4w-libiconv-50/lib" --configure-option=--with-gmp-includes="/nix/store/nwfxg1dpzpkq9w2awp4zs5jawn4fvyb0-gmp-6.2.1-dev/include" --configure-option=--with-gmp-libraries="/nix/store/j75k7na64g7xly1gxrkz44sby1gdc0sa-gmp-6.2.1/lib" --configure-option=--with-curses-libraries="/nix/store/bs7hpi27xc0y2qynvx4n1zpnv3s5bnkx-ncurses-6.2/lib" --constraint "binary == 0.8.7.0" --constraint "transformers == 0.5.6.2" --constraint "mtl == 2.2.2" --constraint "hpc == 0.6.0.3" --constraint "ghc-boot-th == 8.8.4" --constraint "ghc-boot == 8.8.4" --constraint "template-haskell == 2.15.0.0" --constraint "text == 1.2.4.0" --constraint "parsec == 3.1.14.0" --constraint "Cabal == 3.0.1.0" --constraint "ghc-heap == 8.8.4" --constraint "ghci == 8.8.4" --constraint "terminfo == 0.4.1.4" --with-gcc="clang" --with-ld="ld" --with-ar="ar" --with-alex="/nix/store/x1qgmqksr03kvdslwakbn4qbi4f5h3bs-alex-exe-alex-3.2.4/bin/alex" --with-happy="/nix/store/ic7q31ff5n34k0x1x1xm8jldzh88c58s-happy-exe-happy-1.19.12/bin/happy"
> Configuring hpc-0.6.0.3...
> ghc-cabal: Encountered missing or private dependencies:
> base >=4.4.1 && <4.14
>
> libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk: No such file or directory
> make[1]: *** [libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk] Error 1
> make: *** [Makefile:124: all] Error 2
For full logs, run 'nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv'.
error: 1 dependencies of derivation '/nix/store/qgyzqd5v4yn32fgns4vqwcr3qrqgy8ii-ghc-8.10.4.20210212-configured-src.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3i1f6vn82wg07dwvr24dm26l45jzx3sw-ghc-8.10.4.20210212.drv' failed to build
error: 1 dependencies of derivation '/nix/store/irws4cdrncz0gdg5m68blqj3h0p86ivx-Cabal-lib-Cabal-3.4.1.0-config.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xrwzqagrirvim8bs8kpiqxikqf78qn30-Cabal-lib-Cabal-3.6.2.0-config.drv' failed to build
Also earlier in the nix-shell log I saw the following:
[217 of 285] Compiling Distribution.Simple.Program.GHC ( libraries/Cabal/Cabal/Distribution/Simple/Program/GHC.hs, bootstrapping/Distribution/Simple/Program/GHC.o )
'apple-a7' is not a recognized processor for this target (ignoring processor)
Things I have tried:
Search for all nix.conf file and add the cache entries as above. run as root: sudo nix-shell sudo nix-build etc.
I am not familiar with nix and I might have missed some steps to be done prior to running nix-shell
PS. Also would like to clean the nix caches? So I can try again with clean cache. Is it the following?
rm $HOME/.cache/nix/binary-cache-v*.sqlite*
or is there a nix command for this?
And the nix log command for further details did not work either:
nix log /nix/store/40hp5wypw0djadrrcb1346hk2y0ridf2-ghc-8.8.4.drv
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
using --extra-experimental-features indicates log is not recognized nix command.
UPDATE: Per suggestion I have updated the nix.conf per https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md
And my exact nix.conf file is now:
sandbox = false
system = x86_64-darwin
extra-platforms = x86_64-darwin aarch64-darwin
experimental-features = nix-command
extra-experimental-features = flakes
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
substituters = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
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=
However, I now see a different error message:
copying path '/nix/store/v3bzn8kiwxaip81hbdv9q3jhkxcmqrhk-git-2.32.0' from 'https://hydra.iohk.io'...
building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'...
ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
error (ignored): error: end of string reached
error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv' failed with exit code 1;
last 2 log lines:
>
> ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
For full logs, run 'nix log /nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'.
(use '--show-trace' to show detailed location information)
I see this running under both both bash and zsh shells
Here is full trace:
sudo nix-shell --show-trace
building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls- files.drv'...
ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv' failed with exit code 1
… while realising the context of path '/nix/store/g0769lx8bm7lna4gsdchiayk6n7gdcx5-git-ls-files/files'
at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:146:26:
145| submoduleDirs = lines (readFile (files + "/submoduleDirs"));
146| files = lines (readFile (files + "/files"));
| ^
147| };
… while evaluating 'lines'
at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:33:11: