Repository navigation
nix: explicitly set runtime executables via env - #4588
Conversation
Bazel sets these variables, mirror that behaviour in Nix in preparation of making the build more environment-agnostic. Signed-off-by: ctkiku <kim.kuparinen@tuni.fi>
|
@hzeller FYI |
There was a problem hiding this comment.
Code Review
This pull request updates flake.nix to define environment variables for executable paths, specifically OPENROAD_EXE, OPENSTA_EXE, YOSYS_EXE, and PYTHON_EXE. The review feedback recommends defining PYTHON_EXE using pkgs.python3.withPackages to create a self-contained Python environment, which avoids relying on the shell's PYTHONPATH and ensures all required dependencies are consistently available.
| OPENROAD_EXE = "${openroad.packages.${system}.default}/bin/openroad"; | ||
| OPENSTA_EXE = "${openroad.packages.${system}.default}/bin/sta"; | ||
| YOSYS_EXE = "${yosys.packages.${system}.default}/bin/yosys"; | ||
| PYTHON_EXE = "${pkgs.python3}/bin/python3"; |
There was a problem hiding this comment.
To make the build truly environment-agnostic (as mentioned in the PR description), it is highly recommended to use pkgs.python3.withPackages to create a self-contained Python environment.
Using ${pkgs.python3}/bin/python3 relies on the shell's PYTHONPATH environment variable to locate dependencies like pandas, numpy, etc. If PYTHON_EXE is invoked in a context where PYTHONPATH is cleared or not fully propagated, execution will fail. Wrapping the interpreter ensures all required dependencies are always available to PYTHON_EXE directly.
PYTHON_EXE = let
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
pandas
numpy
firebase-admin
click
pyyaml
yamlfix
]);
in "${pythonEnv}/bin/python3";
|
Nix build of OpenROAD currently fails, I opened up a PR for it: The-OpenROAD-Project/OpenROAD#11589 Once that's merged, OpenROAD/yosys should probably be bumped in Not sure about the AI feedback, IIUC the packages are already specified above and I can't think of any valid reason why they wouldn't be available. Not a Nix guru, though. |
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. |
|
Just trusting this makes sense as we don't test with nix. |
Bazel sets these variables, mirror that behaviour in Nix in preparation of making the build more environment-agnostic.
Previous PR from which this was split: #4573
@oharboe