brewery
notashelf /
13a38f707b976a7a146bb2c23f0162b8f17c858b

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git

Commit 13a38f707b97

tarball

NotAShelf <raf@notashelf.dev> · 2026-04-24 20:13 UTC

unverified3 files changed+101-0
meta: switch to justfile for task organization

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib4000ab597f94b2dd3dccf1e31fce3a76a6a6964
diff --git a/CMakeLists.txt b/CMakeLists.txtindex edb503c..10ed5a2 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -78,6 +78,7 @@ install(TARGETS nix-ir-plugin LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/n add_executable(regression_test     tests/regression_test.cpp     src/irc/serializer.cpp+    src/irc/parser.cpp )  target_include_directories(regression_test PRIVATEdiff --git a/flake.nix b/flake.nixindex a127312..4f98a7f 100644--- a/flake.nix+++ b/flake.nix@@ -30,6 +30,8 @@           ninja           bear           clang-tools+          just+          entr         ];          env.NIX_PLUGINABI = "0.2";diff --git a/justfile b/justfilenew file mode 100644index 0000000..9ca92f8--- /dev/null+++ b/justfile@@ -0,0 +1,98 @@+# Default recipe, show available commands+default:+    @just --list++# Build all targets+build:+    cmake --build build++# Clean build artifacts+clean:+    rm -rf build+    find tests -name '*.nixir' -delete++# Configure and build from scratch+rebuild: clean+    cmake -B build -G Ninja+    cmake --build build++# Run unit tests+test-unit:+    ./build/regression_test++# Run compilation tests (do all fixtures compile?)+test-compile:+    #!/usr/bin/env bash+    total=0+    success=0+    for f in tests/fixtures/*.nix; do+        total=$((total+1))+        if ./build/nix-irc "$f" "${f%.nix}.nixir" 2>&1 | grep -q "Done!"; then+            success=$((success+1))+        fi+    done+    echo "Compiled: $success/$total test files"+    [ $success -eq $total ]++# Run integration tests+test-integration:+    ./tests/integration/run.sh++# Run all tests+test: test-unit test-compile test-integration+    @echo "All tests passed"++# Run benchmarks+bench:+    ./tests/benchmark/run.sh++# Compile a single Nix file to IR+compile FILE OUTPUT="":+    #!/usr/bin/env bash+    if [ -z "{{OUTPUT}}" ]; then+        file="{{FILE}}"+        output="${file%.nix}.nixir"+    else+        output="{{OUTPUT}}"+    fi+    ./build/nix-irc "{{FILE}}" "$output"++# Load plugin and evaluate Nix expression+eval FILE:+    nix-instantiate --plugin-files ./build/nix-ir-plugin.so --eval --strict "{{FILE}}"++# Format C++ code with clang-format+format:+    find src tests -name '*.cpp' -o -name '*.h' | xargs clang-format -i++# Run clang-tidy on source files+lint:+    find src -name '*.cpp' | xargs clang-tidy --fix++# Show project statistics+stats:+    @echo "Lines of code:"+    @find src -name '*.cpp' -o -name '*.h' | xargs wc -l | tail -1+    @echo ""+    @echo "Test files:"+    @find tests/fixtures -name '*.nix' | wc -l+    @echo ""+    @echo "Build status:"+    @ls -lh build/nix-irc build/nix-ir-plugin.so build/regression_test 2>/dev/null || echo "Not built"++# Run a quick smoke test+smoke:+    ./build/nix-irc tests/fixtures/simple.nix /tmp/smoke.nixir+    nix-instantiate --plugin-files ./build/nix-ir-plugin.so --eval tests/integration/simple_eval.nix++# Generate IR from a Nix file and inspect it+inspect FILE:+    ./build/nix-irc "{{FILE}}" /tmp/inspect.nixir+    @echo "IR bundle size:"+    @ls -lh /tmp/inspect.nixir | awk '{print $5}'+    @echo "Magic number:"+    @xxd -l 4 /tmp/inspect.nixir++# Watch mode, rebuild on file changes+watch:+    find src tests -name '*.cpp' -o -name '*.h' | entr -c just build test-unit