nixpkgs/pkgs/development/lean-modules/proofwidgets/default.nix
Niklas Halonen a26b66330f
lean4: update leanPackages and lean4 4.29.0/1 -> 4.30.0
As reported on FreeBSD forums, updating lean4 to 4.30.0 fails to a
leantar related issue.  We follow the patch mentioned on the FreeBSD
forums and depend on digama0/leangz (that comes with leantar).
However, there doesn't seem to be a reason to disable installing
leantar, so we don't set INSTALL_LEANTAR=OFF like the patch.

References:
- https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295656
- https://cgit.freebsd.org/ports/commit/?id=516f8a5764de5c7bdd0e9f7810601a5057bbc650
- https://lean-lang.org/doc/reference/latest/releases/v4.30.0/#release-v4___30___0
- leanprover/lean4#12822
2026-06-01 22:28:05 +03:00

70 lines
1.8 KiB
Nix

{
lib,
buildLakePackage,
fetchFromGitHub,
fetchNpmDeps,
npmHooks,
nodejs,
}:
let
version = "0.0.95";
src = fetchFromGitHub {
owner = "leanprover-community";
repo = "ProofWidgets4";
tag = "v${version}";
hash = "sha256-LETljr+QEU6CxprR3pB4hUzhgCD8PrIuiPOgTIdhHVM=";
};
in
buildLakePackage {
pname = "lean4-proofwidgets";
inherit version src;
leanPackageName = "proofwidgets";
# ProofWidgets has no Lean dependencies (lake-manifest.json packages = []).
lakeHash = null;
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
# Pre-fetched npm dependencies for the TypeScript widget build
# (npm/rollup in widget/). npmConfigHook installs these offline.
npmDeps = fetchNpmDeps {
name = "lean4-proofwidgets-npm-deps";
inherit src;
sourceRoot = "source/widget";
hash = "sha256-ShH6MDr76wzWQrJvhMWCnklaox/uRsfoe+aYVSo/eNA=";
};
npmRoot = "widget";
# Lake's widgetJsAll target runs `npm clean-install` which wipes
# node_modules and the patched shebangs that npmConfigHook applied.
# Wrap npm to skip ci/clean-install (deps already installed) while
# passing `npm run build` through — same pattern as llama-cpp/evcc.
postConfigure = ''
local realNpm
realNpm="$(type -P npm)"
mkdir -p "$TMPDIR/npm-wrap"
cat > "$TMPDIR/npm-wrap/npm" <<WRAPPER
#!/bin/sh
case "\$1" in ci|clean-install) exit 0 ;; esac
exec "$realNpm" "\$@"
WRAPPER
chmod +x "$TMPDIR/npm-wrap/npm"
export PATH="$TMPDIR/npm-wrap:$PATH"
'';
meta = {
description = "Interactive UI framework for Lean 4 proof assistants";
homepage = "https://github.com/leanprover-community/ProofWidgets4";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
nadja-y
niklashh
];
};
}