Right now this is disabled: in the future my rails
dev projects should "just" ship a shell.nix
for Nix.
I use Ruby on Rails for prototyping web applications, it's quick and useful and it's easy to not shoot yourself in the foot with it for personal projects. A lot of this is about setting up the Ruby Version Manager, node.js and the YARN package manager for Node.js's development. I think it's kind of funny the way people respond to Rails these days, but it continues to be an incredible tool for rapid prototyping and exploration of simple data driven applications. Of course life is hard when you're hitting the limits of MRI, but if you have a thing that can fit in a sqlite database on your laptop or a heroku hobby dyno, you can't really complain.
I use Robe for ruby
development, rather than the LSP. I
additionally install a pry
frontend for
the Emacs debugger realgud
, even if I've never used it, as well as
projectile-rails
and yari
, a viewer of Ruby ri
documentation.
use-package realgud-pry)
(use-package yari
(
:config'yari-mode 'motion)
(evil-set-initial-state
:bind (:map evil-leader--default-map"y" . yari)))
(use-package robe
(
:after company
:configpush 'company-robe company-backends)
(
:hook
(ruby-mode . robe-mode)
(ruby-mode . ruby-electric-mode))use-package projectile-rails
(
:hook
(ruby-mode . projectile-rails-on)
(web-mode . projectile-rails-on))
'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list provide 'cce/ruby) (
I use a tool called Bundix which
generates a Nix
derivation of a Gemfile.lock
which can be
used in nix-shell
.
{ pkgs, ... }:
{
home.packages = [ pkgs.bundix ];
}
Here's a default.nix
to crib on new
projects; shell in to them, run bundix -m
,
then drop in:
with (import <nixpkgs> {});
let
gems = bundlerEnv {
name = "drip-demo";
inherit ruby;
gemdir = ./.;
};
in stdenv.mkDerivation {
name = "drip-demo";
buildInputs = [
gems
gems.wrappedRuby
bundler
nodejs
yarn];
}