-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/build | ||
/lean_packages | ||
result* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ testing frameworks | |
|
||
namespace LSpec | ||
|
||
open Lean | ||
/-- | ||
# TODO: No longer accurate | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
inputs = { | ||
lean = { | ||
url = "github:leanprover/lean4/v4.0.0-m5"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're using There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
}; | ||
nixpkgs.url = "nixpkgs/nixos-unstable"; | ||
flake-utils = { | ||
url = "github:numtide/flake-utils"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = { self, lean, flake-utils, nixpkgs }: | ||
let | ||
supportedSystems = [ | ||
"aarch64-linux" | ||
"aarch64-darwin" | ||
"i686-linux" | ||
"x86_64-darwin" | ||
"x86_64-linux" | ||
]; | ||
inherit (flake-utils) lib; | ||
in | ||
lib.eachSystem supportedSystems (system: | ||
let | ||
leanPkgs = lean.packages.${system}; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
name = "LSpec"; # must match the name of the top-level .lean file | ||
project = leanPkgs.buildLeanPackage { | ||
inherit name; | ||
# deps = [ lean-ipld.project.${system} ]; | ||
# Where the lean files are located | ||
src = ./.; | ||
}; | ||
in | ||
{ | ||
inherit project; | ||
packages = project // { | ||
${name} = project.sharedLib; | ||
}; | ||
|
||
defaultPackage = self.packages.${system}.${name}; | ||
devShell = pkgs.mkShell { | ||
inputsFrom = [ project.executable ]; | ||
buildInputs = with pkgs; [ | ||
leanPkgs.lean-dev | ||
]; | ||
LEAN_PATH = "./src:./test"; | ||
LEAN_SRC_PATH = "./src:./test"; | ||
}; | ||
}); | ||
} |
There was a problem hiding this comment.
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