I want these programs to be installed in my user environment while not using nix-shell and nix-env (I was told to not use nix-env). I tried to use home-manager but I can't do program.file/ripgrep bc it's not an option. May I ask what is the common approach to install things like file and ripgrep in NixOS?
What is the common way to install utility programs like file and ripgrep in NixOS
725 Views Asked by zoey1771 At
2
There are 2 best solutions below
0

You should be able to set this in your nixos config:
environment.systemPackages = [
rigrep
file
];
I have no experience with home-manager so I don't know how it compares, but you should surely be able to install ripgrep with it.
I've been using nix-env
for years without issue, only negatives is it's harder to keep track of things. But works fine for things you want to install 'temporarily' to have them available in your $PATH without having to invoke nix-shell.
With home-manager, you can install programs by adding them by adding them in
home.packages
. For instance, if you want to install ripgrep, you could add in yourhome.nix
:Or, more conveniently
You can add any program you want in that list.
Note that there is a difference between installing them with home-manager, and by adding it in
environment.systemPackages
, which is that the former will only install them for the user, while the latter will install system-wide. Besides that, both work similarly.