-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #701 from cachix/rails
Add RubyOnRails example
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -ex | ||
rails new blog -d=postgresql | ||
devenv up& | ||
timeout 20 bash -c 'until echo > /dev/tcp/localhost/5100; do sleep 0.5; done' | ||
(cd blog && rails db:create) | ||
curl -s http://localhost:5100/ | grep "version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
ruby "3.2.2" | ||
|
||
gem "rails" | ||
gem "puma" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Based on [the official tutorial](https://guides.rubyonrails.org/getting_started.html). | ||
|
||
```shell-session | ||
$ devenv shell | ||
$ rails new blog -d=postgresql | ||
$ devenv up | ||
$ cd blog && rails db:create | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ pkgs, lib, ... }: | ||
|
||
{ | ||
languages.ruby.enable = true; | ||
languages.ruby.version = "3.2.2"; | ||
|
||
services.postgres.enable = true; | ||
|
||
processes.rails.exec = "rails server"; | ||
|
||
enterShell = '' | ||
export PATH="$DEVENV_ROOT/blog/bin:$PATH" | ||
bundle | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
inputs: | ||
nixpkgs: | ||
url: github:NixOS/nixpkgs/nixpkgs-unstable | ||
nixpkgs-ruby: | ||
url: github:bobvanderlinden/nixpkgs-ruby | ||
inputs: | ||
nixpkgs: | ||
follows: nixpkgs |