3 ms·
This is an active area of work; check out the docs for "experimental commands" at https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix.html https://nix
by callahad 5y ago
This is an active area of work; check out the docs for "experimental commands" at https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix.html https://nixos.org/manual/nix/unstable/command-ref/new-cli/ni..., especially `nix profile` and `nix search`, where your examples would become:
nix profile install nixpkgs#package_name
nix search nixpkgs keyword
- dmitriid 5y ago1. How common is it to search outside nixpkgs? 2. How common is it to install from outside nixpkgs? Depending on the answers to the above: `nix install packagename` should default to nixpkgs and install into currently active profile (if auch a thing as currently active profile is a thing in nix, of course) `nix search packagename` should default to searching nixpkgs Boom. You improved developer/user experience 100-fold with little effort. Edit: 99.9% of examples in the linked page have nixpkgs# prefix for packages. Just drop it, and make it default. Everyone will thank you.
- kaba0 5y agoI remember there is a thread on this exact issue. The problem is more that there is no one nixpkgs channel, but several.
- callahad 5y agoMuch more common than you would expect coming from a traditional package manager, since Nix freely allows multiple versions of packages to coexist. E.g., many folks run a stable release of NixOS but install select user packages from unstable, while most development environment and packaging scenarios will pin to a specific commit of nixpkgs. Nevertheless, there is an alternative CLI that infers "nixpkgs" when omitted, but I can't seem to find it right now.
- lucideer 5y agoI think nix already does what you want for search, but the install suggestion is a good idea. `nix install packagename` would fall outside the current command convention (since `profile` is a command and `install` is a subcommand of profile), so they would have to introduce a new top-level command "install" which is aliased to `profile install`. Given the `nix` command itself is a newer/experimental alternative to `nix-env`, et al., in a seemingly similar spirit to `apt-get/apt-cache` -vs- `apt`, I think creating such an alias would be a very reasonable thing to do. `nix search packagename` afaik currently does what you (probably) want. It defaults to searching in both `packages.<system>` & `legacyPackages.<system>`, so nixpkgs will be included. I suspect the inclusion of `nixpkgs` in the examples above is actually narrowing the search, possibly for speed: doing `nix search packagename` is currently a bit slow.