summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorMalte Voos <git@mal.tc>2025-04-11 01:11:46 +0200
committerMalte Voos <git@mal.tc>2025-04-15 21:41:46 +0200
commit52fc07062e41d9b9c00edf7e48187bd4058cdb93 (patch)
treeafb0d5e0dd6c753689685a0e5e9096c133205dd9 /flake.nix
downloadlean-brooks-main.tar.gz
lean-brooks-main.zip
init main
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ac2e3a4
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,50 @@
+{
+  description = "Lean 4 Example Project";
+
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+    flake-parts.url = "github:hercules-ci/flake-parts";
+    lean4-nix = {
+      url = "github:lenianiva/lean4-nix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+  };
+
+  outputs = inputs @ {
+    nixpkgs,
+    flake-parts,
+    lean4-nix,
+    ...
+  }:
+    flake-parts.lib.mkFlake {inherit inputs;} {
+      systems = [
+        "aarch64-darwin"
+        "aarch64-linux"
+        "x86_64-darwin"
+        "x86_64-linux"
+      ];
+
+      perSystem = {
+        system,
+        pkgs,
+        ...
+      }: {
+        _module.args.pkgs = import nixpkgs {
+          inherit system;
+          overlays = [(lean4-nix.readToolchainFile ./lean-toolchain)];
+        };
+
+        packages.default =
+          (pkgs.lean.buildLeanPackage {
+            name = "Example";
+            roots = ["Main"];
+            src = pkgs.lib.cleanSource ./.;
+          })
+          .executable;
+
+        devShells.default = pkgs.mkShell {
+          packages = with pkgs.lean; [lean lean-all];
+        };
+      };
+    };
+}