tweag / monad-bayes

A library for probabilistic programming in Haskell.
MIT License
407 stars 62 forks source link

Slow compilation (hours) with "nix develop" #218

Closed lukego closed 1 year ago

lukego commented 1 year ago

Describe the bug Starting a development environment with nix develop takes a long time (hours.)

I am not an experienced Haskell programmer but I suspect that this is unexpected.

To Reproduce Run nix develop in top level of repo on a NixOS machine.

Answer affirmative when offered binary caches.

Expected behavior Open a development environment in minutes by downloading cached binaries.

Environment

Additional context

Transcript after approximately one hour:

[luke@snowy:~/git]$ git clone https://github.com/tweag/monad-bayes
...

[luke@snowy:~/git]$ cd monad-bayes/

[luke@snowy:~/git/monad-bayes]$ nix develop
do you want to allow configuration setting 'extra-substituters' to be set to 'https://tweag-monad-bayes.cachix.org https://tweag-wasm.cachix.org' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'tweag-monad-bayes.cachix.org-1:tmmTZ+WvtUMpYWD4LAkfSuNKqSuJyL3N8ZVm/qYtqdc= tweag-wasm.cachix.org-1:Eu5eBNIJvleiWMEzRBmH3/fzA6a604Umt4lZguKtAU4=' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
warning: ignoring untrusted substituter 'https://tweag-monad-bayes.cachix.org'
warning: ignoring untrusted substituter 'https://tweag-wasm.cachix.org'
trace: To make project.plan-nix for haskell-project a fixed-output derivation but not materialized, set `plan-sha256` to the output of the 'calculateMaterializedSha' script in 'passthru'.
trace: To materialize project.plan-nix for haskell-project entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.
[1/134/778 built, 260 copied (708.4 MiB), 233.7 MiB DL] building ghc-8.10.7 (buildPhase): "inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O -Wall     -this-unit-id ghci-8.10.7 -hide-all-packages -package-env - -i -ili

This is the first time I tried to setup a Haskell development environment via Nix.

idontgetoutmuch commented 1 year ago

This is saying it's not going to use the cache

warning: ignoring untrusted substituter 'https://tweag-monad-bayes.cachix.org'
warning: ignoring untrusted substituter 'https://tweag-wasm.cachix.org'

What I don't know is why.

idontgetoutmuch commented 1 year ago

Can you look in /etc/nix and see what you have? You should have something like

build-users-group = nixbld
experimental-features = nix-command flakes
trusted-users = your name 

For this to take effect, I am pretty sure you have to stop and restart the nix daemon.

lukego commented 1 year ago

@idontgetoutmuch Thanks! I didn't realize that I needed to be in trusted-users. This seems to have gotten the cache working :+1:

purcell commented 1 year ago

Fwiw, I think (or would hope) that cachix use .... would either update the nix conf accordingly, or flag that further changes might be required.