Skip to content

Instantly share code, notes, and snippets.

@brandoncc
Last active December 11, 2024 05:19
Show Gist options
  • Save brandoncc/ae4b1d4c3ab6ee0895b6cc5a57e19fbf to your computer and use it in GitHub Desktop.
Save brandoncc/ae4b1d4c3ab6ee0895b6cc5a57e19fbf to your computer and use it in GitHub Desktop.
Creating a new Rails app with nix and devenv
  1. mkdir hello_world
  2. cd hello_world
  3. devenv init
  4. devenv inputs add nixpkgs-ruby github:bobvanderlinden/nixpkgs-ruby --follows nixpkgs
  5. direnv allow .
  6. echo ruby-3.3.6 > .ruby-version (use most recent version of Ruby)
  7. Change the content of devenv.nix to:
    { pkgs, lib, config, inputs, ... }:
    
    {
      packages = [ pkgs.git pkgs.foreman pkgs.libyaml.dev ];
    
      languages.javascript = {
        enable = true;
        npm.enable = true;
      };
    
      languages.ruby = {
        enable = true;
        versionFile = ./.ruby-version;
      };
    }
  8. gem install rails
  9. cd .. && cd - (otherwise the newly-installed rails will not be in the path)
  10. THOR_MERGE="nvim -d" rails new -c tailwind .
  11. Choose to merge .gitignore and any other files
  12. Copy content of temporary file into the file in the directory (such as .gitignore)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment