Created
May 21, 2023 02:39
-
-
Save goofansu/c676a14143ed3c1124d3c92950a4df3b to your computer and use it in GitHub Desktop.
Nix: basic configuration for a newly created Rails 7 application
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
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then | |
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" | |
fi | |
use flake | |
PATH_add bin |
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
{ | |
description = "Rails 7 dev environment"; | |
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | |
inputs.flake-utils.url = "github:numtide/flake-utils"; | |
outputs = { self, nixpkgs, flake-utils }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let pkgs = nixpkgs.legacyPackages.${system}; | |
in with pkgs; { | |
devShells.default = pkgs.mkShell { | |
packages = [ ruby_3_2 postgresql_14 redis ]; | |
shellHook = '' | |
export PGDATA=$PWD/.pgdata | |
# Initialize MySQL data directory | |
if [ ! -d "$PGDATA" ]; then | |
initdb $PGDATA | |
fi | |
''; | |
}; | |
}); | |
} |
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
web: bin/rails server -p 3000 | |
css: bin/rails tailwindcss:watch | |
db: postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment