Created
March 7, 2016 04:31
-
-
Save tvon/a89be0dfc32bef5c6fd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activate() { | |
if [ $# -eq 0 ]; | |
then | |
if [ -f .nix ]; | |
then | |
nix-shell .nix -A localEnv | |
else | |
echo '.nix file not found' 1>&2 | |
fi | |
else | |
nix-shell ~/dev/environments/$1.nix -A localEnv | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> {}; | |
stdenv = pkgs.stdenv; | |
ruby = pkgs.ruby_2_3_0; | |
postgresql = pkgs.postgresql; | |
in rec { | |
localEnv = stdenv.mkDerivation rec { | |
name = "ruby-2.3.0"; | |
version = "1.0"; | |
GEM_HOME = "${builtins.getEnv "HOME"}/.gems-ruby-2.3.0"; | |
GEM_PATH = "${GEM_HOME}:${builtins.getEnv "GEM_PATH"}"; | |
PATH = "${builtins.getEnv "PATH"}:${GEM_HOME}/bin"; | |
shellHook = '' | |
export PS1="\n\[\033[1;32m\][$(ruby --version):\w]$\[\033[0m\] " | |
''; | |
src = ./.; | |
buildInputs = with pkgs; [ | |
ruby | |
postgresql | |
# For nokogiri, needs to be installed via | |
# gem install nokogiri -- --use-system-libraries | |
# pkg-config seems to work for setting the paths. | |
git libxml2 libxslt libffi pkgconfig | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment