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>
This commit is contained in:
Greg Shuflin
2026-03-19 04:38:22 -07:00
co-authored by Claude Opus 4.6
parent 3569373c6f
commit 27890be7a2
3 changed files with 53 additions and 0 deletions
+1
View File
@@ -1 +1,2 @@
/.lake
result
+34
View File
@@ -11,6 +11,40 @@
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 {
+18
View File
@@ -0,0 +1,18 @@
_default:
@just --list
build:
nix develop --command lake build
# Run the AST printer on a C file
run file:
nix develop --command .lake/build/bin/lean-libclang {{file}}
# Build and run via nix
nix-run file:
nix run . -- {{file}}
# Clean build artifacts
clean:
nix develop --command lake clean