postgres support

This commit is contained in:
hakutaku
2025-09-17 20:27:51 +03:00
parent ba97fb0ab2
commit c36bcbf06e
21 changed files with 2072 additions and 181 deletions

View File

@@ -1,5 +1,6 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.05";
postgresDirectory = ".data/postgres";
pkgs = import nixpkgs {
config = { };
@@ -21,15 +22,28 @@ let
);
in
[
phpForRuntimeWithXDebug
pkgs.treefmt
pkgs.postgresql_16
pkgs.nixfmt-rfc-style
pkgs.gnumake
phpForRuntimeWithXDebug
pkgs.php82Extensions.curl
pkgs.php82Packages.composer
];
in
pkgs.mkShell {
inherit packages;
}
shellHook = ''
# https://yannesposito.com/posts/0024-replace-docker-compose-with-nix-shell/index.html
if [ ! -d var/log ]; then
mkdir -p var/log
fi
if [ ! -d ${postgresDirectory} ]; then
mkdir -p ${postgresDirectory}
initdb -D ${postgresDirectory}
pg_ctl -D ${postgresDirectory} -l var/log/postgres.log -o "--unix_socket_directories='$PWD'" start
createdb app
pg_ctl -D ${postgresDirectory} stop
fi
'';
}