Zulip Chat Archive

Stream: lean4 dev

Topic: Lean4 nix build?


Tom (Sep 21 2024 at 23:54):

I am trying to build Lean 4 from source to submit a small PR. I am following the instructions here.

I've installed nix and cloned the repo but after running nix develop I get errors along with

trace: warning: The Nix-based build is deprecated

Is this build not supported anymore, or am I doing something wrong?

Mario Carneiro (Sep 22 2024 at 00:43):

there are build instructions both with and without nix

Mario Carneiro (Sep 22 2024 at 00:43):

you should use the one appropriate for your OS

Tom (Sep 22 2024 at 06:11):

yeah, I think I can make that work but was curious if the Nix build (which is supposed to work on MacOS, Linux and Windows) is actually deprecated or if I'm doing something wrong.

Sebastian Ullrich (Sep 22 2024 at 06:31):

Merely using the dev shell is not deprecated, the warning is just overzealous

Tom (Sep 22 2024 at 07:10):

Thanks for confirming!

Notification Bot (Sep 22 2024 at 17:54):

Tom has marked this topic as resolved.

Tom (Sep 22 2024 at 21:44):

FWIW, the nix instructions didn't "just work" for me on MacOS so I built Lean following the "manual" steps and submitted the PR that way. Unfortunately, I don't know enough about Nix and the Nix lean setup to help fix the issue but just FYI.

Leni Aniva (Oct 24 2024 at 23:06):

I made a Lean 4 nix flake here: https://github.com/lenianiva/lean4-nix

Eric Wieser (Dec 11 2024 at 06:43):

What is the step between running nix develop and getting a lean binary?

Notification Bot (Dec 11 2024 at 06:43):

Eric Wieser has marked this topic as unresolved.

Eric Wieser (Dec 11 2024 at 06:48):

In particular, the suggested

# in the Lean rootdir
elan toolchain link lean4 build/release/stage1
elan toolchain link lean4-stage0 build/release/stage0

commands don't work because build/release isn't actually created by nix develop

Eric Wieser (Dec 11 2024 at 06:54):

Ah, nix develop .#test seems to make progress

Sebastian Ullrich (Dec 11 2024 at 07:21):

Eric Wieser said:

What is the step between running nix develop and getting a lean binary?

The generic build instructions shared with all other platforms

Eric Wieser (Dec 11 2024 at 08:56):

Oh, I read "that's it" as "you can stop reading all further instructions".

Alex Keizer (Dec 11 2024 at 13:03):

nix develop just puts you in a shell that has all the right dependencies in PATH, but you still have to do the actual build

Sebastian Ullrich (Dec 11 2024 at 13:13):

I can see how the wording is not ideal :)

Eric Wieser (Dec 11 2024 at 18:37):

I guess I was hoping I could somehow use nix to get a cached build rather than having to wait for a full compile

Tom (Dec 11 2024 at 18:45):

(I had the same question a while ago but didn't get a good answer - or at least one I could understand, given that I don't really use nix. Also, I think I had the same misunderstanding as you :grinning:)

Having said that, the non-nix build instructions are pretty good. Especially if you install ccache, the (incremental) builds are pretty quick.

Tom (Dec 11 2024 at 18:49):

haha, I didn't notice you revived my old thread!


Last updated: May 02 2025 at 03:31 UTC