nixos-search
nixos-search copied to clipboard
Allow defaulting to nixpkgs (non-NixOS) instead of nixos
The search site is super useful for us at my site, except that since we're running Nix on top of Debian instead of NixOS, users need to use the "On non-NixOS" tab instead of the "On NixOS" one, and it isn't particularly obvious to a casual user that they need to notice the tab and click on it.
I'm not asking to change the overall default (and I'm betting you don't want to), but it would be helpful if there's some way we could present our users a view that defaults to the non-NixOS view. Some possible thoughts:
- A special URL like
https://search.nixos.org/nixpkgsthat sets a cookie that causes you to default to the non-NixOS tab, and we could link to that URL in our internal docs - A special query-string component like
?nixpkgs=truethat gets preserved in all links, and again we could link to that URL - A separate deployment of the website that defaults to the non-NixOS tab
- Auto-detection based on whether the user-agent appears to be NixOS (but maybe enough people actually are looking for NixOS commands from non-NixOS browsers that this is a bad idea?)
I'm happy to contribute a patch if any of these seem like a good idea to you. Thanks!
I'd much rather unify what we currently have than split things further. The only difference between the two tabs is changing a channel name from nixpkgs to nixos, surely we can convey both instructions on a single screen.
Something like
$ nix-env -iA nixpkgsOrNixos.hello
or
$ nix-env -iA channel.hello # `channel` is usually `nixos` on NixOS and `nixpkgs` on non-NixOS
or
$ nix-env -iA nixos.hello # on NixOS
$ nix-env -iA nixpkgs.hello # on non-NixOS
I agree with these. Its basically the same command More so, with the new nix command we have the additional (but mutually exclusive) way to install using profiles
nix profile install nixpkgs#hello
And what still bothers me is that we do not mention configuration.nix but encourage the non-nix'y way of installing software.
For quick use of software telling people about nix shell appears quite important to me as well..
The whole idea of having those instructions there feels a lot like "giving a man a fish" anyway. I think Nix users should be expected to know how to install a package (using the method of their choice) given its attribute name. Perhaps we should then somehow clarify that the blue linky thing is the attribute name while the thing after "Name:" is the package name.
In before either of yours' time, and before this was redone in Elm, we had discussed about the problem, and what we ended up deciding was to wait on the redesign of the search app, and on the redesign of the Nix CLI to decide how to approach this.
The solution should probably avoid using nix-env on NixOS, and prefer recommending any other way (nix-shell, configuration.nix) so it makes things really awkward to convey through a small snippet in the search.
My gut feeling is the search should probably not describe any way to use the data, but provide a link to a ressource explaining what to do with the attribute name. This way we only need to put the attribute name at the center of the stage, and provide educational resources.
As a contrary example, sites like npm or pip or crates all show an instruction on how to install. Linking to a place that discern the different methods would be important nonetheless but having a copy able snippet to just get a shell with the program I still consider most useful.
This is going to be solved with Nix 3.0 namely with flakes.
Until then lets persist the selection in localstorage for each user.