Define Nix environment on non-NixOS distro

Noob here needing some help…

I’ve installed Nix using “Single User installation” method (from manual), on CentOS distro. That is, I have a Nix profile in ~/.nix-profile which is always activated in my ~/.bash_profile using . ~/.nix-profile/etc/profile.d/nix.sh.

Now I want to create a single .nix configuration file to define all packages that I use (git, tmux etc.). The goal is to be able to just use something like nix-env -i config.nix which will automatically install all software I need on a fresh machine. I also want change configuration for some packages that support it, e.g. build custom Vim according to guides such as Vim - NixOS Wiki.

I couldn’t figure it from reading Nix and NixOS docs and most of information I found is specific to NixOS distro (e.g. Home Manger-based stuff).

Please, revisit home-manager documentation GitHub - nix-community/home-manager: Manage a user environment using Nix [maintainer=@rycee] and https://rycee.gitlab.io/home-manager/options.html

home-manager is not NixOS specific and could still be your solution.

2 Likes