57 lines
1.4 KiB
Nix
57 lines
1.4 KiB
Nix
{
|
|
description = "A basic flake with a shell";
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
inputs.systems.url = "github:nix-systems/default";
|
|
inputs.flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
inputs.systems.follows = "systems";
|
|
};
|
|
|
|
outputs =
|
|
{ nixpkgs, flake-utils, ... }:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
bashInteractive
|
|
|
|
# Executables
|
|
nodejs
|
|
pnpm
|
|
postgresql
|
|
|
|
# Dev Tools
|
|
typescript-language-server
|
|
astro-language-server
|
|
];
|
|
|
|
shellHook = ''
|
|
export PORT=300
|
|
export PGDIR=$PWD/postgres
|
|
export PGHOST=$PGDIR
|
|
export PGDATA=$PGDIR/data
|
|
export PGLOG=$PGDIR/log
|
|
export DATABASE_URL="postgresql:///postgres?host=$PGDIR"
|
|
|
|
if test ! -d $PGDIR; then
|
|
mkdir $PGDIR
|
|
fi
|
|
|
|
if [[ ! -d "$PGDATA" ]]; then
|
|
initdb $PGDATA --auth=trust >/dev/null
|
|
|
|
cat >> "$PGDATA/postgresql.conf" <<-EOF
|
|
unix_socket_directories = '$PGHOST'
|
|
EOF
|
|
fi
|
|
|
|
echo "Bun Version: $(bun --version)"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|