genson
January 9, 2024, 4:56pm
31
tobiasBora:
Imperative-style installation is definitely possible (even if conceptually, adding packages to configuration.nix is not really more complicated, especially if you already have NixOs installed… the imperative style often make you forgot what you installed). nix-env however is maybe not the best tool for that as it as some drawbacks and is starting to look more and more like a legacy tool. A website https://stop-using-nix-env.privatevoid.net/ has even been created explaining why nix-env should be avoided, in favor of nix profile. This way, you can install programs imperatively with:
$ nix profile install nixpkgs#hello
You can search for softwares using:
$ nix search nixpkgs yourpackage
or using search.nixos.org/
This is great information. It is difficult to remember when you don’t do it everyday though. It would go a long way if they would either change the nix-env tab on the nixos.org packages search or add a new tab for nix profile.