Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --dry-run to all the new nix commands #7227

Open
anka-213 opened this issue Oct 27, 2022 · 3 comments
Open

Add --dry-run to all the new nix commands #7227

anka-213 opened this issue Oct 27, 2022 · 3 comments
Labels
feature Feature request or proposal

Comments

@anka-213
Copy link

anka-213 commented Oct 27, 2022

Is your feature request related to a problem? Please describe.
I've been missing the ability to try out commands without actually running them. It is often possible to do it with the correct

nix build <something> --dry-run

but it's frustratingly difficult to figure out which one. An incomplete list of commands where I have been missing it:

  • nix run foo#bar --dry-run
  • nix profile install foo#bar --dry-run
  • nix profile upgrade '.*' --dry-run
  • nix develop --dry-run
  • nix flake update --dry-run

Describe the solution you'd like
Add a --dry-run flag to as many as possible of the new nix something commands, that shows what would happen without actually doing it.

Describe alternatives you've considered
As I mentioned above, there is sometimes an argument that could be given to nix build to get the desired behaviour, but it's difficult to find out which one and it is annoying to need to change the entire command instead of just adding a flag. You can also just run the command and immediately press ctrl-c, which is often what I have done as a workaround, but that doesn't always work.

Additional context

@anka-213 anka-213 added the feature Feature request or proposal label Oct 27, 2022
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2-questions-about-flake-upgrading-packages/22800/4

@cx405
Copy link

cx405 commented Mar 11, 2023

This would be very useful, for example when creating a large configuration.nix for reasons of checking its correctness without instantiating the changes on disk.

@thenbe
Copy link
Contributor

thenbe commented Jul 20, 2023

nix flake update --dry-run

I found this thread as I was searching for a way to view updates only (without updating the flake.lock). The --dry-run flag would be a welcome addition for this use case. To confirm, there is no native way to currently get this behavior, right?

Anyways, the best I've managed so far is using process substitution:

# The poor man's `--dry-run`. Allows you to see available updates without updating flake.lock.
nix flake update --output-lock-file <(cat flake.nix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal
Projects
None yet
Development

No branches or pull requests

4 participants