add nix flake devshell and process-compose
mirrors youngstartup setup. flake provides php 8.4, composer, nodejs, postgresql, cypress, typescript, process-compose. shellHook seeds a per-repo postgres cluster at .postgres/. process-compose orchestrates postgres + backend (laravel) + vite (vue spa) for local dev. .envrc auto-loads the flake via direnv. mailpit and gitlab-ci-local omitted - not needed for tide blogging app.
This commit is contained in:
parent
91cc08614d
commit
d1df7a6a42
5 changed files with 165 additions and 0 deletions
48
flake.nix
Normal file
48
flake.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
onefetch
|
||||
php
|
||||
phpPackages.composer
|
||||
phpPackages.php-codesniffer
|
||||
vscode-langservers-extracted
|
||||
sqlite
|
||||
nodejs
|
||||
nixfmt-rfc-style
|
||||
nixfmt-tree
|
||||
cypress
|
||||
yaml-language-server
|
||||
typescript
|
||||
postgresql
|
||||
process-compose
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export PGDATA="$PWD/.postgres"
|
||||
export PGHOST="$PGDATA"
|
||||
export PGUSER="postgres"
|
||||
export PGDATABASE="postgres"
|
||||
|
||||
if [ ! -d "$PGDATA" ]; then
|
||||
echo "[pg] initializing cluster at $PGDATA"
|
||||
initdb --auth=trust --username=postgres --no-locale --encoding=UTF8 >/dev/null
|
||||
{
|
||||
echo "listen_addresses = '127.0.0.1'"
|
||||
echo "unix_socket_directories = '$PGDATA'"
|
||||
} >> "$PGDATA/postgresql.conf"
|
||||
fi
|
||||
|
||||
echo "[dev] run 'process-compose up' to start postgres + backend + vite"
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue