Skip to content

Instantly share code, notes, and snippets.

@davexunit
Created March 18, 2016 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davexunit/64e19a70b4eb1419386c to your computer and use it in GitHub Desktop.
Save davexunit/64e19a70b4eb1419386c to your computer and use it in GitHub Desktop.
# Create a Guix container that shares the host's network devices, SSH
# config, and MySQL socket directory. The container includes all of
# the software that is needed to build the gem set with Bundler.
guix environment --container --network --share=$HOME/.ssh --share=/run/mysqld \
--ad-hoc ruby bundler mysql imagemagick libxml2 libxslt gcc-toolchain \
make git coreutils openssh libffi pkg-config which sed gawk openssl
# Tweak the environment such that Ruby gems end up in the right place
# and their binaries can be found.
export GEM_HOME=$PWD/.gems
export PATH=$GEM_HOME/bin:$PATH
# Create /usr/bin/env so Ruby scripts work.
mkdir -p /usr/bin && ln -s $(which env) /usr/bin/env
# Bundle!
bundle config build.nokogiri --use-system-libraries --with-xml2-include=$C_INCLUDE_PATH/libxml2 && bundle
# Start the server!
rails server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment