postgres support
This commit is contained in:
20
shell.nix
20
shell.nix
@@ -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
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user