50 lines
1.1 KiB
Nix
50 lines
1.1 KiB
Nix
let
|
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.05";
|
|
postgresDirectory = ".data/postgres";
|
|
|
|
pkgs = import nixpkgs {
|
|
config = { };
|
|
overlays = [ ];
|
|
};
|
|
|
|
packages =
|
|
let
|
|
phpForRuntimeWithXDebug = (
|
|
pkgs.php82.buildEnv {
|
|
extensions = (
|
|
{ enabled, all }:
|
|
enabled
|
|
++ (with all; [
|
|
xdebug
|
|
])
|
|
);
|
|
}
|
|
);
|
|
in
|
|
[
|
|
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
|
|
'';
|
|
}
|