Files
Greg ShuflinandClaude Opus 4.6 27890be7a2 Add nix build output and justfile
Add packages.default flake output that builds the lean-libclang binary
via nix build. Add justfile with build, run, nix-run, and clean recipes.
Add 'result' to .gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 04:38:22 -07:00

72 lines
2.0 KiB
Nix

{
description = "Lean 4 bindings to libclang";
inputs = {
lean4-nix.url = "github:lenianiva/lean4-nix";
nixpkgs.follows = "lean4-nix/nixpkgs";
};
outputs = { self, nixpkgs, lean4-nix }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems f;
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (lean4-nix.readToolchainFile ./lean-toolchain) ];
};
libclang = pkgs.llvmPackages.libclang;
in {
default = pkgs.stdenv.mkDerivation {
pname = "lean-libclang";
version = "0.1.0";
src = self;
nativeBuildInputs = [
pkgs.lean.lean-all
pkgs.llvmPackages.clang
];
buildInputs = [
libclang.dev
libclang.lib
];
env = {
LEAN_CC = "${pkgs.llvmPackages.clang}/bin/clang";
};
buildPhase = ''
export HOME=$(mktemp -d)
lake build
'';
installPhase = ''
mkdir -p $out/bin
cp .lake/build/bin/lean-libclang $out/bin/
'';
};
});
devShells = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (lean4-nix.readToolchainFile ./lean-toolchain) ];
};
libclang = pkgs.llvmPackages.libclang;
in {
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.lean.lean-all
pkgs.llvmPackages.clang
];
buildInputs = [
libclang.dev
libclang.lib
];
env = {
LEAN_CC = "${pkgs.llvmPackages.clang}/bin/clang";
};
};
});
};
}