<p>So the solution was simply to install <code>nix-darwin</code></p>
<p><a href="https://github.com/LnL7/nix-darwin" rel="nofollow noreferrer">https://github.com/LnL7/nix-darwin</a></p>
<p>simply follow the instruction on the github page above, and now I can access my <code>nix-shell</code></p>

CC BY-SA 4.0
2022-01-11T14:09:53.560Z
What is `nix-darwin` and why does installing it fix this issue?
runeks
CC BY-SA 4.0
2022-01-13T08:09:37.160Z
@runeks it's like a driver or plugin to make nix compatible with macos
Owen Yuwono
CC BY-SA 4.0
2022-01-14T07:43:17.023Z
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
CC BY-SA 4.0
2022-01-25T12:25:46.693Z
I've installed `nix-darwin` but still have the same behavior.
Daniel Cukier
CC BY-SA 4.0
2022-02-25T07:39:52.023Z
@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
CC BY-SA 4.0
2021-09-08T07:52:13.253Z
2021-09-08T07:52:13.253Z
Owen Yuwono
<p>I had the same problem on my Mac M1 Pro and my issue had to do with my <code>ghc</code> installation. I had installed version <code>8.10.7</code> through <code>nix-darwin</code> and when I switched from that installation to the same version of <code>ghc</code> installed using <code>ghcup</code> 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).</p>
<p>If that still doesn't solve your problem, I would suggest downloading the repo that broke and try running <code>cabal build --verbose</code> inside of it, that's how I figured out what the problem was.
Check what the <code>src</code> is of the nix derivation that breaks:</p>
<pre><code>$ nix show-derivation /nix/store/kkjbrl5bbpmirwfhhs89k1q7ahm7zqih-hnix-lib-hnix-0.14.0.5.drv

{
   ...
   &quot;src&quot;: &quot;/nix/store/ymkyz2z612zsi183x5mjqbn65vy1a6li-hnix-0.14.0.5.tar.gz&quot;,
   ...
}
</code></pre>
<p>The problem I had was that the <code>cabal build</code> gave me a Clang error due to some missing library (libz).</p>

CC BY-SA 4.0
2022-04-13T09:19:30.797Z
2022-04-13T09:19:30.797Z
carleryd
<p>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.</p>
<p><strong>Hardware</strong></p>
<p>I'm using Macbook Pro Intel 2020, macOS Monterrey Beta 6</p>
<p><strong>Problem</strong></p>
<p>So the problem was when I was running <code>nix-shell</code> in the plutus repository for the first time, and after downloading all the dependencies, the <code>nix-shell</code> stuck at <code>Building library for hnix-#.#.#</code> and <code>[1 of 50] Compiling Nix.Atoms</code>.</p>
<p>What I did before compiling was installing Nix from the official documentation <a href="https://nixos.org/download.html" rel="noreferrer">https://nixos.org/download.html</a></p>
<p>I also did configure the binary cache from <a href="https://github.com/input-output-hk/plutus#iohk-binary-cache" rel="noreferrer">https://github.com/input-output-hk/plutus#iohk-binary-cache</a></p>
<p>Also tried to start with and without <a href="https://github.com/input-output-hk/plutus#nix-on-macos" rel="noreferrer">https://github.com/input-output-hk/plutus#nix-on-macos</a></p>
<p>All to no success, still stuck at <code>Building library for hnix-#.#.#</code> and <code>[1 of 50] Compiling Nix.Atoms</code></p>

CC BY-SA 4.0
2021-11-09T05:16:16.640Z
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 https://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
<plutus><nix><nix-shell><macos>
nix-shell stuck on Building library for hnix
# nix-shell stuck on Building library for hnix

(Asked by: username_0 on 2021-09-08)

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`

**Tags:** plutus, nix, nix-shell, macos
> **Comments:**
> **username_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 https://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  

---

## 2 answers

### Answer by username_0 on 2021-09-08. Score: 1 | Accepted answer

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`

> **Comments:**
> **username_2**: What is `nix-darwin` and why does installing it fix this issue?  
> **username_0**: @runeks it's like a driver or plugin to make nix compatible with macos  
> **username_2**: 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`.  
> **username_3**: I've installed `nix-darwin` but still have the same behavior.  
> **username_2**: @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...  

---

### Answer by username_4 on 2022-04-13. Score: 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).


---

