kadena-io / block-explorer

https://explorer.chainweb.com
8 stars 7 forks source link

Issues during nix-build w/ aeson. Resolved (for me at least) with steps in issue. #69

Closed mbwmbw1337 closed 9 months ago

mbwmbw1337 commented 1 year ago

Ran the nix-build -A exe

Ran into errors on /nix/store/4nhckqi5k6pncszwcgpgk6lh1b8acnb8-aeson-1.4.5.0.drv.

encodeToTextBuilder (Data/Aeson/Encode.hs:29) Warning: Data.Aeson.Types: could not find link destinations for: GToJSON CoerceText GetConName ConstructorNames SumFromString GFromJSON' withBoundedScientific Warning: Data.Aeson: could not find link destinations for: GToJSON CoerceText GetConName ConstructorNames SumFromString GFromJSON' withBoundedScientific Warning: Data.Aeson.TH: could not find link destinations for: JSONFun ToJSONFun Encoding sumToValue StarKindStatus opaqueSumToValue recordSumToValue Documentation created: dist/doc/html/aeson/index.html, dist/doc/html/aeson/aeson.txt installing Installing library in /nix/store/m4wa4zai1jy840l7fgcc68xf4whqn9fp-aeson-1.4.5.0/lib/ghc-8.6.5/x86_64-linux-ghc-8.6.5/aeson-1.4.5.0-8jgeKLQhDRAASR5idYdkt0 Setup: Error: Could not find module: Data.Aeson with any suffix: ["dyn_hi"] in the search path: ["dist/build"] error: builder for '/nix/store/4nhckqi5k6pncszwcgpgk6lh1b8acnb8-aeson-1.4.5.0.drv' failed with exit code 1 error: 1 dependencies of derivation '/nix/store/gsr7wc189g92k3hcv6hhxalsdrnql0x9-common-0.1.drv' failed to build error: 1 dependencies of derivation '/nix/store/pjinxa0c5mk1xnyhissiy7ns9r1fn058-constraints-extras-0.3.0.2.drv' failed to build error: 1 dependencies of derivation '/nix/store/m0nx67w09clwzhr6ivla5x7y0pbrp0rn-hlint-2.2.2.drv' failed to build error: 1 dependencies of derivation '/nix/store/4j37dglddyrb8avrcfpn4f7g8k2sny7s-http-conduit-2.3.7.1.drv' failed to build error: 1 dependencies of derivation '/nix/store/0997z5f9z5vg36r3j0m9i2k8w1r1wvpp-http2-2.0.3.drv' failed to build error: 1 dependencies of derivation '/nix/store/hgnh0kdi1y3r0badpx7vz8qjgrh0mq34-jsaddle-0.9.7.0.drv' failed to build error: 1 dependencies of derivation '/nix/store/bll0r2srn6jy6kwwx8q83ygbylrif5by-jsaddle-warp-0.9.7.0.drv' failed to build error: 1 dependencies of derivation '/nix/store/fy023k544m3ycc170ldzz1690g6r4ksg-monoidal-containers-0.6.0.1.drv' failed to build error: 1 dependencies of derivation '/nix/store/imrjdicp5cxdn912pm6q3wqgi7rrlw65-obelisk-route-0.2.drv' failed to build error: 1 dependencies of derivation '/nix/store/pkqi88bqcisf54mlran47lbwyiy8rf7n-reflex-dom-core-0.6.1.0.drv' failed to build error: 1 dependencies of derivation '/nix/store/x1rdkww0gnwk7ir8ck7w32yzya21hxbf-snap-1.1.2.0.drv' failed to build error: 1 dependencies of derivation '/nix/store/q3wmh2h17s2z18kllyz4rfmgvfgnxnn8-these-1.0.1.drv' failed to build error: 1 dependencies of derivation '/nix/store/5qpxx394f5avdiarn1s636wq4bgnhij3-wai-extra-3.0.28.drv' failed to build error: 1 dependencies of derivation '/nix/store/r561qbaizf8dlr3gxh6fbzl6smgfnjv0-backend-0.1.drv' failed to build error: 1 dependencies of derivation '/nix/store/m70may0rqzx00n83h052jl38y48s86ws-serverExe.drv' failed to build

Looks like something might have been missing on the cabal file.

Resolved via:

  1. sudo apt-get install cabal-install
  2. cd ~/mightbyteissexy/Source/block-explorer
  3. cabal update
  4. cabal install aeson
  5. nix-build -A exe
enobayram commented 9 months ago

Hi @mbwmbw1337, sorry for the late response here.

What you've experienced is a little surprising, but not entirely impossible. The legacy nix-build way of organizing Nix projects wasn't airtight, in that without special care, your local changes could leak into the Nix build. So it's not hard to imagine you having some local state that confused the build infrastructure here.

The good news is, we've added a Nix flakes based build setup to block-explorer a while ago and one of the major benefits of flakes is that it has strong measures against this kind of unintended cross-talk from your local repository (and OS) state. So, in the future, you should be able to avoid issues like this by building the exe by nix build .#exe (or even nix build github:kadena-io/block-explorer#exe without a local checkout).

Note that in order to conform to the isolation level that Nix flakes provide, we had to use the experimental recursive-nix feature to wrap the legacy build setup into an isolated derivation. So you either need to make sure that recursive-nix is enabled (add experimental-features: flakes nix-command recursive-nix to your /etc/nix/nix.conf and restart the Nix daemon) in order to build it locally or you can fetch the result from nixcache.chainweb.com without needing to enable recursive-nix.

I believe this Nix flakes based build is a solution to this error, so I'm closing this issue.