Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby + Nix
{
oldPkgs ? import (fetchGit {
url = https://github.com/NixOS/nixpkgs;
ref = "3b9b8726bdbb5405919c40920d9693c5eae246b5";
}) {},
newPkgs ? import (fetchGit {
url = https://github.com/NixOS/nixpkgs;
ref = "nixos-19.03";
}) {}
}:
let
ruby = oldPkgs.ruby_2_1_10;
in newPkgs.mkShell {
buildInputs = with newPkgs; [
ruby
libxml2.dev
libxslt.dev
newPkgs.parallel
oldPkgs.mysql55
oldPkgs.openssl
oldPkgs.redis
oldPkgs.nodejs
newPkgs.imagemagick
];
shellHook = ''
mkdir -p .local-data/gems
export GEM_HOME=$PWD/.local-data/gems
export GEM_PATH=$GEM_HOME
export PATH="$GEM_PATH/bin:$PATH"
gem install bundler -v '1.15.4'
gem install nokogiri -v '1.5.11' -- --with-xml2-lib=${newPkgs.libxml2.dev}/lib \
--with-xml2-include=${newPkgs.libxml2.dev}/include/libxml2
gem install mysql2 -v '0.3.21'
mkdir -p .local-data/mysql/data
if [ -z "$(ls -A .local-data/mysql/data)" ]; then
mysql_install_db --datadir="$PWD/.local-data/mysql/data" --socket="$PWD/.local-data/mysql/mysqld.sock"
fi
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment