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:
co-authored by
Claude Opus 4.6
parent
3569373c6f
commit
27890be7a2
@@ -1 +1,2 @@
|
||||
/.lake
|
||||
result
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user