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

packages: Offer more installation method suggestions and discourage nix-env -i #508

Closed
roberth opened this issue Jul 27, 2022 · 4 comments · Fixed by #514
Closed

packages: Offer more installation method suggestions and discourage nix-env -i #508

roberth opened this issue Jul 27, 2022 · 4 comments · Fixed by #514

Comments

@roberth
Copy link
Member

roberth commented Jul 27, 2022

Currently the package details only suggest nix-env.

nix-env is considered bad practice by many, so we should at least offer better, declarative and/or non-global installation methods in the packages search details.

  • NixOS environment.systemPackages
  • home-manager
  • package or nix-shell
    • with callPackage
    • with pkgs
    • as nativeBuildInputs
    • as buildInputs

This also solves the problem in docs and conversations of having to explain the general idea of "package installation" over and over again, which involves either a roundtrip to ask what sort of installation they need (might not even be clear) or, in the case of docs, trying to explain multiple methods.
Knowing the attribute path also means that we can show relevant instructions for dealing with nested attributes in callPackages.

Related: #506 (comment)

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/depreciate-the-use-of-nix-env-to-install-packages/20139/36

@fricklerhandwerk
Copy link
Contributor

Also nix-shell -p.

I fully agree nix-env should not be the first or only suggestion. Presenting all these options would need a different UI, e.g. a link to a page listing all the options and linking to a tutorial piece for details.

See nix-versions for an example.
It also shows nix-env first.

@roberth
Copy link
Member Author

roberth commented Jul 29, 2022

Presenting all these options would need a different UI

Presentation of the search results is handled by a single page application written in Elm. It is already set up to display multiple tabs with an installation method in each of them.
I don't see much of a technical reason to build a new kind of page, but it would be nice to have a page that displays only a single package. Linking to the search results can be a bit noisy, both in the url and on screen.

@fricklerhandwerk
Copy link
Contributor

Ah, I missed that tab thingy. In that case, great.

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 a pull request may close this issue.

3 participants