This is an exploration of setting up a vanilla Rails app using the Nix package manager.
MIT License
This is an exploration of setting up vanilla Rails apps using the Nix package manager.
I'm using an Ubuntu VM via Vagrant to ensure the environment is as isolated as possible from my own local environment (MacOS).
In the local (MacOS) environment:
brew cask install vagrant
brew cask install virtualbox
In the local (MacOS) environment:
git clone [email protected]:floehopper/rails-on-nix.git
In the local (MacOS) environment:
cd rails-on-nix
vagrant up
Provisioning the VM takes quite a while!
Installs the Nix package manager.
For each Rails app (rails-postgres-app
& rails-mysql-app
):
Gemfile
and ephemeral Nix shells to generate the Gemfile.lock
, gemset.nix
& shell.nix
files to make the appropriate version of the Rails gem, its dependent gems, and its dependent OS packages available.gemset.nix
& shell.nix
files generated in the previous step, generates a new Rails app.Gemfile.lock
, gemset.nix
& shell.nix
files to make the gems bundled in the Rails app, their dependent gems, and their dependent OS packages available.gemset.nix
& shell.nix
files generated in the previous step:
rails yarn:install
or rails webpacker:install
depending on the major version of RailsOn your local machine, run:
vagrant ssh
On the VM, run:
cd $RAILS_APP_NAME
nix-shell
Most of the provisioning operations are fairly idempotent, but I haven't tested this thoroughly.
Multiple Rails apps requiring different versions of Bundler.
Investigate using direnv/lorri in conjunction with nix to seamlessly move between different Rails app directories. See: https://github.com/direnv/direnv/wiki/Nix.
Investigate using Nix home-manager to provide a more generic environment on the VM to create the Rails app, i.e. run rails new
.
Investigate using Nix to make node.js packages available instead of yarn.