Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add nix flake #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Anderssorby
Copy link

@Anderssorby Anderssorby commented Jul 11, 2022

Add a nix flake build to this repo

@@ -19,6 +19,7 @@ testing frameworks

namespace LSpec

open Lean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I try to avoid opening namespaces like that. This file compiles just fine without this line

{
inputs = {
lean = {
url = "github:leanprover/lean4/v4.0.0-m5";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using leanprover/lean4:nightly-2022-08-09 in the lean-toolchain file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no tag for that release. You can ofc set it to the explicit git commit hash.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we need to get the git commit hash of the Lean 4 version every time we do a toolchain bump?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, idk how lake fetches the data. It is probably possible to tie into that with nix as well.

@lenianiva
Copy link
Contributor

Is there any update to this? The lean-toolchain file has stabilized and we can probably use something like

    lean = {
      url = "github:leanprover/lean4?ref=v4.4.0";
    };

as a flake input

@lenianiva
Copy link
Contributor

lenianiva commented Oct 7, 2024

Update: Lean's official flake build is deprecated leanprover/lean4#4895

I might create a Lean4 nix repo sometimes later to replace this, but I don't think having the user handle the build themselves is very difficult, e.g.

      lspecLib = leanPkgs.buildLeanPackage {
        name = "LSpec";
        roots = [ "Main" "LSpec" ];
        src = "${lspec}";
      };

      test = leanPkgs.buildLeanPackage {
        name = "Test";
        roots = [ "Test.Main" ];
        deps = [ lspecLib repl ];
        src = pkgs.lib.cleanSource (pkgs.lib.cleanSourceWith {
          src = ./.;
          filter = path: type:
            !(pkgs.lib.hasInfix "Pantograph" path);
        });
      };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants