Merge pull request #348 from woolcoxm/fix/nix-flake-packaging-345
fix(flake): package engine, support modules, and python for Nix builds
This commit is contained in:
@@ -26,7 +26,9 @@
|
|||||||
version = "1.0";
|
version = "1.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
# python3 is needed by checkPhase: `make test-c` shells out to
|
||||||
|
# `python3 tools/run_tests.py` (see c/Makefile, PYTHON ?= python3).
|
||||||
|
nativeBuildInputs = [ pkgs.makeWrapper pkgs.python3 ];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.gcc
|
pkgs.gcc
|
||||||
@@ -44,18 +46,29 @@
|
|||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out/bin
|
|
||||||
cp c/glm $out/bin/glm
|
|
||||||
|
|
||||||
# Wrap coli (the Python CLI) so it finds the right python and the engine
|
# Self-contained layout under $out/lib/colibri that mirrors the
|
||||||
mkdir -p $out/share/colibri
|
# source tree `coli` runs in (see the path-resolution logic at the
|
||||||
cp c/coli $out/share/colibri/coli
|
# top of c/coli): the engine, the coli CLI script, the support
|
||||||
chmod +x $out/share/colibri/coli
|
# modules it imports (openai_server.py, resource_plan.py,
|
||||||
cp -r c/tools $out/share/colibri/tools
|
# doctor.py), and tools/ all sit next to each other.
|
||||||
|
mkdir -p $out/lib/colibri/tools $out/bin
|
||||||
|
cp c/glm $out/lib/colibri/glm
|
||||||
|
cp c/coli $out/lib/colibri/coli
|
||||||
|
chmod +x $out/lib/colibri/coli
|
||||||
|
cp c/openai_server.py c/resource_plan.py c/doctor.py $out/lib/colibri/
|
||||||
|
cp -r c/tools/* $out/lib/colibri/tools/
|
||||||
|
|
||||||
|
# $out/bin holds the user-facing entry points.
|
||||||
|
ln -s ../lib/colibri/glm $out/bin/glm
|
||||||
|
|
||||||
|
# Wrap coli: point it at the bundled engine (COLI_ENGINE) so it is
|
||||||
|
# found by default, and at the module dir (PYTHONPATH) so
|
||||||
|
# `import openai_server` / `resource_plan` / `doctor` resolve.
|
||||||
makeWrapper ${pythonEnv}/bin/python $out/bin/coli \
|
makeWrapper ${pythonEnv}/bin/python $out/bin/coli \
|
||||||
--add-flags "$out/share/colibri/coli" \
|
--add-flags "$out/lib/colibri/coli" \
|
||||||
--set PYTHONPATH "${pythonEnv}/${pkgs.python3.sitePackages}"
|
--set COLI_ENGINE "$out/lib/colibri/glm" \
|
||||||
|
--set PYTHONPATH "$out/lib/colibri:${pythonEnv}/${pkgs.python3.sitePackages}"
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user