Fix nix develop invocation for verification scripts

run_script() launches the DRC/LVS scripts with

    nix develop --command <script>

from a working directory of OPTS.openram_temp. nix develop resolves its
flake from the working directory, and the temp directory has no
flake.nix, so the command fails before the script ever runs:

    path '/tmp/openram_<user>_<pid>_temp' does not contain a 'flake.nix', searching up
    error: could not find a flake.nix file

Nothing is written to the report file, so verification then dies on the
missing output rather than on the nix error itself, which makes this
confusing to diagnose:

    ERROR: file magic.py: Unable to load LVS results from
    /tmp/openram_<user>_<pid>_temp/<name>.lvs.report
    FileNotFoundError: [Errno 2] No such file or directory

Name the flake explicitly so it is resolved from the repository while
the script still runs in the temp directory, which the scripts depend on
for their relative copies.

Verified on a sky130 build with use_nix = True: before the change no
report is produced and the run asserts, after it both DRC and LVS run
through the devShell and write their reports.
This commit is contained in:
ThVerg 2026-08-11 15:03:55 +02:00
parent ed369f1af4
commit 5696584608
1 changed files with 5 additions and 0 deletions

View File

@ -33,10 +33,15 @@ def run_script(cell_name, script="lvs"):
start = time.time()
with open(outfile, 'wb') as fo, open(errfile, 'wb') as fe:
if OPTS.use_nix:
# The script runs in openram_temp, which has no flake.nix, so the
# flake has to be named explicitly or nix searches up from the temp
# directory, fails, and the script never runs at all.
repo_root = os.path.abspath(os.path.join(os.environ["OPENRAM_HOME"], ".."))
p_cmd = [
"nix",
"--extra-experimental-features", "nix-command flakes",
"develop",
"path:{}".format(repo_root),
"--command",
scriptpath,
]