Are some environment variables not respected in DSL2? Are there alternatives?

Hi everyone, first time poster and just started building some workflows. Would really appreciate some help

It seems that the following environment variables are not respected in DSL2 workflows (tested in Nextflow ≥25.04):

# Expected locations for runtime metadata
export NXF_HOME="${HOME}/.nextflow"
export NXF_LOG="${HOME}/.nextflow/logs/nextflow.log"
export NXF_OUT="${HOME}/.nextflow/output"
export NXF_TEMP="${HOME}/.nextflow/tmp"
export NXF_CACHE="${HOME}/.nextflow/cache"

Despite these being set, Nextflow writes:

  • .nextflow/ (containing cache/, plr/, history, etc.)
  • nextflow.log

to the current working directory, i.e. wherever nextflow run is invoked.

Is this a bug or an intentional design choice (or my own mistake/misunderstanding)?

If it’s by design, doesnt this behavior breaks a fundamental assumption for many environments: that runtime metadata can be centrally redirected and isolated. In our case (proprietary workflows under version control), it means:

  • Source directories may be polluted with internal runtime state
  • Logs and caches appear unpredictably in developer machines - depending on where the workflow was run.
  • Caching and log tracking becomes brittle, as it now implicitly depends on users running the workflow from the exact same path or directory structure

Is there a mechanism to redirect both .nextflow/ and nextflow.log**, similar to how NXF_WORK and NXF_SINGULARITY_CACHEDIR can be configured?

Would appreciate any clarification - or if I’ve just missed something in the docs or something fundamental to how users should be running these workflows when shared (and proprietary to that group).

Thank you very much guys - loving nextflow so far.

You can check the proper variable names here: Environment variables — Nextflow documentation

NXF_LOG should be NXF_LOG_FILE
NXF_CACHE should be NXF_CACHE_DIR
NXF_OUT doesn’t seem to exist at all
NXF_TEMP is not related to the files you listed