Skip to content

Instantly share code, notes, and snippets.

@jonknapp
Created January 22, 2022 21:44
Show Gist options
  • Save jonknapp/c5930b532d0a145124a4cef04b3a132e to your computer and use it in GitHub Desktop.
Save jonknapp/c5930b532d0a145124a4cef04b3a132e to your computer and use it in GitHub Desktop.
nix shell script that provides the env needed to "rails new" a project
# https://ghedam.at/15978/an-introduction-to-nix-shell
with (import <nixpkgs> {});
mkShell {
buildInputs = [
gcc
gnumake
libiconv
libxml2
libxslt
nodejs
openssl
pkgconfig
postgresql
readline
ruby
yarn
zlib
];
shellHook = ''
gem_home=$(mktemp -d)
echo "Using temporary folder for gems... $gem_home"
export GEM_HOME=$gem_home
export GEM_PATH=$GEM_HOME
export PATH=$GEM_HOME/bin:$PATH
export name="rails-bootstrap: $gem_home"
gem list -i ^bundler$ || gem install bundler --no-document
gem list -i ^rails$ || gem install rails --no-document
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment