adds flake and direnv setup

This commit is contained in:
Dennis Schoepf 2026-02-16 21:24:09 +01:00
parent efae6283bb
commit 2c65bc585e
3 changed files with 3473 additions and 0 deletions

58
flake.nix Normal file
View file

@ -0,0 +1,58 @@
{
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
biome
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)"
'';
};
}
);
}