5

I'm just gonna post a problem that I've been experiencing for a few days (and having a hard time searching for the answer on the internet) and the solution, so that future questions can refer to this solution.

Hardware

I'm using Macbook Pro Intel 2020, macOS Monterrey Beta 6

Problem

So the problem was when I was running nix-shell in the plutus repository for the first time, and after downloading all the dependencies, the nix-shell stuck at Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms.

What I did before compiling was installing Nix from the official documentation https://nixos.org/download.html

I also did configure the binary cache from https://github.com/input-output-hk/plutus#iohk-binary-cache

Also tried to start with and without https://github.com/input-output-hk/plutus#nix-on-macos

All to no success, still stuck at Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms

1
  • can I ask how you installed nix-darwin ? I have the same issue as you had (Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms.) I get this error when I try to install it: ~ % nix-build github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer ./result/bin/darwin-installer error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/store/v1rhxl3ln24zlx8dbmhcrwbwydfmzj6a-master.tar.gz/default.nix:1:13 zsh: no such file or directory: ./result/bin/darwin-installer
    – Jan
    Commented Nov 9, 2021 at 5:16

2 Answers 2

1

So the solution was simply to install nix-darwin

https://github.com/LnL7/nix-darwin

simply follow the instruction on the github page above, and now I can access my nix-shell

5
  • What is nix-darwin and why does installing it fix this issue?
    – runeks
    Commented Jan 11, 2022 at 14:09
  • @runeks it's like a driver or plugin to make nix compatible with macos Commented Jan 13, 2022 at 8:09
  • 1
    where did read this? As far as I can see it's a way to configure macOS using a declarative configuration (similar to NixOS). I don't see the connection between this and fixing nix-build hanging when building hnix.
    – runeks
    Commented Jan 14, 2022 at 7:43
  • 1
    I've installed nix-darwin but still have the same behavior. Commented Jan 25, 2022 at 12:25
  • @DanielCukier which terminal application and CPU architecture do you use? On my MacBook Pro M1, I just experienced the compilation of Nix.Atoms hang in iTerm2 running with Rosetta emulation (so that the command arch run in this terminal outputs i386). Then I tried to compile using the built-in Terminal app without Rosetta emulation (so that the command arch run in this terminal outputs arm64) and this successfully compiled Nix.Atoms. Given that OP is on Intel hardware it may, somehow, be the terminal application that causes the hang...
    – runeks
    Commented Feb 25, 2022 at 7:39
0

I had the same problem on my Mac M1 Pro and my issue had to do with my ghc installation. I had installed version 8.10.7 through nix-darwin and when I switched from that installation to the same version of ghc installed using ghcup the problem disappeared (as a side note, when you're in the nix-shell, make sure you're using the shell's version of ghc and not your own, should be 8.10.4.20210212).

If that still doesn't solve your problem, I would suggest downloading the repo that broke and try running cabal build --verbose inside of it, that's how I figured out what the problem was. Check what the src is of the nix derivation that breaks:

$ nix show-derivation /nix/store/kkjbrl5bbpmirwfhhs89k1q7ahm7zqih-hnix-lib-hnix-0.14.0.5.drv

{
   ...
   "src": "/nix/store/ymkyz2z612zsi183x5mjqbn65vy1a6li-hnix-0.14.0.5.tar.gz",
   ...
}

The problem I had was that the cabal build gave me a Clang error due to some missing library (libz).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.