Created
October 8, 2024 04:12
-
-
Save danelowe/f115bd17aa709326f825359b81a52309 to your computer and use it in GitHub Desktop.
Set Up Rails Dev env
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
# initdb -D .direnv/postgres/data | |
# | |
{ | |
description = "Ruby dev"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { nixpkgs, flake-utils, ... }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let | |
pkgs = import nixpkgs { | |
inherit system; | |
overlays = [ (import ./overlay.nix) ]; | |
}; | |
in | |
{ | |
devShell = pkgs.mkShell | |
{ | |
packages = with pkgs; [ | |
ruby_3_3 | |
postgresql_14 | |
process-compose | |
sqlfluff | |
pnpm_8 | |
nodejs_20 | |
imagemagick | |
cmake | |
ffmpeg | |
redis | |
libyaml | |
openssl_3_3 | |
heroku | |
caddy | |
cacert | |
]; | |
shellHook = '' | |
mkdir -p ./.direnv/postgres/data | |
rm ./.direnv/process-compose.yml && ln -s ${./process-compose.yml} ./.direnv/process-compose.yml | |
export PGDATA=".direnv/postgres/data" | |
''; | |
}; | |
}); | |
} | |
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
version: "0.5" | |
processes: | |
postgres: | |
command: postgres | |
redis: | |
command: redis-server | |
frontend: | |
command: pnpm dev | |
rails: | |
command: bin/rails server | |
proxy: | |
command: caddy reverse-proxy --from app.zakada.net --to http://localhost:3000 --internal-certs | |
clock: | |
command: bin/rails clock:run | |
worker: | |
command: bundle exec sidekiq |
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
# An overlay allows for a package set to be extended with new or modified packages | |
# `final` refers to the package set with all overlays applied. | |
# This allows for added or modified packages to be referenced with | |
# all relevant changes | |
final: | |
# `prev` refers to the previous package set before this current overlay is applied. | |
# This is cheaper for nix to evaluate, thus should be prefered over final when possible. | |
prev: | |
{ | |
# 16.14 now requires experimental import assertions syntax, pin to 16.13 | |
# https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md | |
nodejs_20 = prev.nodejs_20.overrideAttrs (oldAttrs: rec { | |
version = "20.11.1"; | |
sha256 = "sha256-/dU6VynZNmkaKhFRBG+0iXchy4sPyir5V4I6m0D+DDQ="; | |
name = "nodejs-${version}"; | |
src = prev.fetchurl { | |
url = "https://nodejs.org/dist/v${version}/node-v${version}.tar.xz"; | |
sha256 = "sha256-d4E+2/P38W0tNdM1NEPe5OYdXuhNnjE4x1OKPAylIJ4"; | |
}; | |
}); | |
} |
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
# This file is part of the main nix-darwin config, and contains all the customisation to zsh, plugins etc. | |
# The alias is in here because you can't add aliases in a shellHook with direnv. | |
... | |
shellAliases = { | |
... | |
up = "process-compose -p 9090 -f .direnv/process-compose.yml"; | |
}; | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment