You can use nix-shell for this. It turns you into a shell tuned for a given nix expression. Initially, this expression could simply be on the lines buildInputs = [ pkgs.ruby ]; , and you can develop it. There are a number of useful articles on the web written by nix users that give more examples of using nix-shell, like this garbas.si
It may also be helpful for you to get a better understanding of how nix packages work. There is a separate nixpkgs manual , which is described in more detail using nix to create package expressions. A quick snapshot of the third section should be helpful to give a little more insight. There is also a chapter on using nix with ruby ββbundler, which may be useful for you. Again, there are articles that give more examples of its use, for example, one of stesie.imtqy.com .
If you need postgresql to work in your environment, nix cannot handle this for you; its function is solely to create and manage packages, and not to activate them. You can simply activate postgres manually, use the nix-shell hook, or create some other integration with nix, but I think the most reliable option is to use a Linux distribution built on top of Nix - NixOS . NixOS integrates with nix packages and manages the services provided by the packages. You can create a NixOS configuration with postgres enabled and an existing development environment. This utility from github.com/chrisfarms may also be of interest.
source share