Skip to content

fix(apply): standardise --eval-only output#197

Merged
water-sucks merged 1 commit intonix-community:mainfrom
Sporif:apply-fix-eval-only-output
Feb 26, 2026
Merged

fix(apply): standardise --eval-only output#197
water-sucks merged 1 commit intonix-community:mainfrom
Sporif:apply-fix-eval-only-output

Conversation

@Sporif
Copy link
Copy Markdown
Collaborator

@Sporif Sporif commented Feb 26, 2026

The output from apply --eval-only with legacy nixos-cli is a very long attribute, which is probably not what the user expects. Fix that by copying the nix-instantiate arguments from the remote build case, so that only the drv path is outputted. The flake version is similarly adjusted.

Also, adjust the log messages so that they follow the build only format by displaying:

  • a different step message for each build type
  • the drv path upon successful evaluation.

The output from `apply --eval-only` with legacy `nixos-cli` is a
very long attribute, which is probably not what the user expects.
Fix that by copying the `nix-instantiate` arguments from the remote
build case, so that only the drv path is outputted. The flake
version is similarly adjusted.

Also, adjust the log messages so that they follow the build only
format by displaying:
 - a different step message for each build type
 - the drv path upon successful evaluation.
Copy link
Copy Markdown
Collaborator

@water-sucks water-sucks left a comment

Choose a reason for hiding this comment

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

Fair enough, this makes sense in my testing.

}

log.Info("evaluation successful")
log.Infof("the evaluated derivation is %v", drvPath)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: would you think it's useful to output to stdout for usage in pipelines? Not really too much of a concern considering we don't do it for build-only anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think that is useful but probably best to solve in a separate issue/PR, as there may be more questions, e.g., what other options or commands could output useful data to stdout? Should we add json output?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah sounds good, we can talk about it later.

@water-sucks water-sucks merged commit 004e3f2 into nix-community:main Feb 26, 2026
2 checks passed
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.

2 participants