Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
79 lines (68 loc) · 3.05 KB
/
Copy pathflake.nix
File metadata and controls
79 lines (68 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
description = "Dev shell for the Skills Rails app (Ruby 4.0 / Node 24 / PostgreSQL 18)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
# Toolchain pinned to match .tool-versions / docker-compose.yml.
# (nixpkgs ships Ruby 4.0.10, matching the project.)
packages = with pkgs; [
ruby_4_0
nodejs_24 # Node 24 runtime (also ships corepack and yarn 4.12.1)
#yarn-berry_4 # Yarn 4.14.x — matches the Yarn 4 line pinned in package.json
postgresql_18
just # task runner (see ./justfile)
# Build/runtime deps for native gems
pkg-config
libxml2 # nokogiri
libxslt # nokogiri
libffi # ffi / ruby-vips
libyaml # psych
openssl
zlib
postgresql_18.lib # libpq for the pg gem
vips # ruby-vips (loaded at runtime via FFI)
imagemagick # mini_magick (shells out to the CLI)
graphicsmagick
];
# Static env vars: any non-special attribute is exported into the shell.
# (Path-derived vars that need $PWD live in shellHook — see below.)
# Database connection (matches config/database.yml defaults).
RAILS_DB_HOST = "127.0.0.1";
RAILS_DB_PORT = "5432";
RAILS_DB_USERNAME = "skills";
RAILS_DB_PASSWORD = "skills";
# Project-local PostgreSQL (managed via the justfile).
PGPORT = "5432";
PGUSER = "skills";
shellHook = ''
# Path-derived vars: kept here because attribute values are not
# shell-expanded, so $PWD must be resolved at shell-entry time.
# --- Project-local state, nothing installed globally -----------------
export PROJECT_ROOT="$PWD"
export BUNDLE_PATH="$PROJECT_ROOT/vendor/bundle"
export BUNDLE_BIN="$PROJECT_ROOT/vendor/bundle/bin"
export GEM_HOME="$BUNDLE_PATH"
export PATH="$BUNDLE_BIN:$PATH"
# Yarn 4 comes from nixpkgs (yarn-berry_4) — no corepack download needed.
# --- Project-local PostgreSQL data dir / socket ----------------------
export PGDATA="$PROJECT_ROOT/tmp/postgres/data"
export PGHOST="$PROJECT_ROOT/tmp/postgres/sockets"
echo
echo ' Skills dev shell ready. Tasks are managed with `just` — run `just` for the list.'
echo
echo ' First time: just init (gems + JS deps + database)'
echo ' Develop: just dev Test: just test Lint: just lint'
echo
'';
};
});
};
}