Files
lux/flake.nix
Brandon Lucas 26d340b5a3 chore: fix flake.nix rebuild detection
Better source change detection using find instead of single file check.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 03:54:36 -05:00

71 lines
2.4 KiB
Nix

{
description = "Lux - A functional programming language with first-class effects";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustToolchain
cargo-watch
cargo-edit
pkg-config
openssl
];
RUST_BACKTRACE = "1";
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
shellHook = ''
# Build and add lux to PATH
if [ ! -f target/release/lux ] || [ Cargo.toml -nt target/release/lux ] || [ -n "$(find src -name '*.rs' -newer target/release/lux 2>/dev/null | head -1)" ]; then
echo "Building lux..."
cargo build --release
fi
export PATH="$PWD/target/release:$PATH"
printf "\n"
printf " \033[1;35m \033[0m\n"
printf " \033[1;35m \033[0m\n"
printf " \033[1;35m \033[0m v0.1.0\n"
printf "\n"
printf " Functional language with first-class effects\n"
printf "\n"
printf " \033[1mCommands:\033[0m\n"
printf " lux Start the REPL\n"
printf " lux \033[3m<file.lux>\033[0m Run a file\n"
printf " lux compile \033[3m<file.lux>\033[0m JIT compile and run\n"
printf "\n"
printf " \033[1mDevelopment:\033[0m\n"
printf " cargo build Build the compiler\n"
printf " cargo test Run tests\n"
printf "\n"
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "lux";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
};
}
);
}