Skip to content

Instantly share code, notes, and snippets.

@stravid
Created August 7, 2021 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stravid/c419f4b43dedaaa3cca8d2f255c3f4a1 to your computer and use it in GitHub Desktop.
Save stravid/c419f4b43dedaaa3cca8d2f255c3f4a1 to your computer and use it in GitHub Desktop.
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