Skip to content

nix: explicitly set runtime executables via env - #4588

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gtkiku:nix-envvars
Oct 2, 2026
Merged

maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gtkiku:nix-envvars

Conversation

@gtkiku

@gtkiku gtkiku commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

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

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>
@oharboe

oharboe commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

@hzeller FYI

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread flake.nix
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";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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";

@gtkiku

gtkiku commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

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 flake.nix and kept in sync with the submodules.

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.

@openroad-ci

Copy link
Copy Markdown
Member

🔍 QoR check

Metrics reflect the PR merge build — i.e. what will land on the target branch.

Commit 5ac088b · Jenkins build #1 · Baseline: build · View build on dashboard

62 design(s) checked — 0 with regression(s), 0 without a comparable baseline.

@maliberty
maliberty merged commit c712df0 into The-OpenROAD-Project:master Oct 2, 2026
11 of 12 checks passed
@maliberty

Copy link
Copy Markdown
Member

Just trusting this makes sense as we don't test with nix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants