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 a README section on Nix #26
Conversation
Thanks for adding this @lrworth! |
There are many ways to run `unused` with Nix, but the simplest is: | ||
|
||
```sh | ||
nix run -f https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.zip unused -c unused --help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be nix-shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I don't know how to do the same with nix-shell, could you please translate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix-shell -p unused --run unused --help
If you just do nix-shell -p unused
it opens a bash shell with unused in your PATH.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That brings up the man page for nix-shell, and
nix-shell -p unused --run 'unused --help'
gives me
error: undefined variable 'unused' at (string):1:94
(use '--show-trace' to show detailed location information)
Is there a nix-shell one-liner to launch unused
without manipulating channels? Note we are aiming for the simplest method here — everyone is going to have their own preferred way to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot the quotes.
Works for me:
nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz -p unused --run 'unused --help'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll make another PR I guess.
There are many ways someone could use the expression in nixpkgs, so I've chosen the simplest possible thing to do: just run
unused
. I hope this provides enough information for someone to use nix-channel and nix-env, or home-manager, or configuration.nix, or their own expression, etc.