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

nix flake update add deprecation warnings. #9449

Merged

Conversation

angerman
Copy link
Contributor

This builds on #8817, to add additional UX help for people with existing muscle memory (or shell history) with --update-input and tries to gently guide them towards the newly evolved CLI UI.

Motivation

This change introduces a deprecation warning for the nix flake lock --update-input INPUT command, guiding users towards the newer nix flake update INPUT syntax. The motivation is to enhance user experience by providing clear and helpful guidance when encountering deprecated commands. This change aligns with our ongoing efforts to streamline Nix commands and improve their intuitiveness and ease of use.

Context

Many users familiar with the older nix flake lock --update-input syntax may not be aware of its deprecation and the transition to the new nix flake update command. The current behavior, which results in an unrecognised flag error, can be confusing and does not guide users towards the correct command. By introducing a deprecation warning, we provide a more user-friendly approach, aiding in a smoother transition to the updated syntax.

Example

Before:

bash-5.2$ outputs/out/bin/nix flake lock --update-input libgit2
error: unrecognised flag '--update-input'

After:

bash-5.2$ outputs/out/bin/nix flake lock --recreate-lock-file
warning: '--recreate-lock-file' is deprecated; use 'nix flake update' instead.
warning: Git tree 'nix' is dirty
warning: updating lock file 'nix/flake.lock':

Priorities

Add 👍 to pull requests you find important.

@github-actions github-actions bot added the new-cli Relating to the "nix" command label Nov 25, 2023
@Ericson2314 Ericson2314 added the error-messages Confusing messages and better diagnostics label Nov 25, 2023
Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

This looks good to me.

(Note for future work) We really need to have some sort of of "deprecated features" which is the dual of "experimental features" to keep track of this stuff.

@grahamc
Copy link
Member

grahamc commented Nov 25, 2023

We really need to have some sort of of "deprecated features" which is the dual of "experimental features" to keep track of this stuff

I'm heading to bed, but I put one together about a month ago. I can send it over :).

Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

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

Couple wording nits, feel free to take or leave them

src/libcmd/installables.cc Outdated Show resolved Hide resolved
src/nix/flake.cc Outdated Show resolved Hide resolved
This builds on NixOS#8817, to add additional UX help for people with existing
muscle memory (or shell history) with --update-input and tries to gently
guide them towards the newly evolved CLI UI.

Co-authored-by: Cole Helbling <[email protected]>
@Ericson2314
Copy link
Member

Ericson2314 commented Nov 25, 2023

Oh please do @grahamc. I always greatly appreciate when someone else knocks an item off my to-do list.

@Ericson2314 Ericson2314 added the backport 2.19-maintenance Automatically creates a PR against the branch label Nov 27, 2023
@@ -47,6 +47,16 @@ MixFlakeOptions::MixFlakeOptions()
{
auto category = "Common flake-related options";

addFlag({
.longName = "recreate-lock-file",
.description = "Recreate the flake's lock file from scratch.",
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk Nov 27, 2023

Choose a reason for hiding this comment

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

This should also show up in documentation.

Suggested change
.description = "Recreate the flake's lock file from scratch.",
.description = R"(
Recreate the flake's lock file from scratch.
> **DEPRECATED**
>
> Use [`nix flake update`](@docroot@/command-ref/new-cli/nix3-flake-update.md) instead.
)",

Not sure about syntax and if the link is exactly right, but something along these lines.

@fricklerhandwerk fricklerhandwerk merged commit f56401a into NixOS:master Nov 27, 2023
9 checks passed
Copy link

Successfully created backport PR for 2.19-maintenance:

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-11-27-nix-team-meeting-minutes-107/36112/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.19-maintenance Automatically creates a PR against the branch error-messages Confusing messages and better diagnostics new-cli Relating to the "nix" command
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants