82 lines
1.9 KiB
Nix
82 lines
1.9 KiB
Nix
{
|
|
inputs = {
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
process-compose.url = "github:Platonic-Systems/process-compose-flake";
|
|
services.url = "github:juspay/services-flake";
|
|
systems.url = "github:nix-systems/default";
|
|
};
|
|
|
|
outputs =
|
|
inputs:
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = import inputs.systems;
|
|
|
|
imports = [
|
|
inputs.process-compose.flakeModule
|
|
];
|
|
|
|
perSystem =
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
php = pkgs.php83;
|
|
phpPackages = pkgs.php83Packages;
|
|
|
|
databasePort = 3306;
|
|
webPort = 8000;
|
|
|
|
in
|
|
with lib;
|
|
{
|
|
|
|
process-compose."default" = {
|
|
imports = [
|
|
inputs.services.processComposeModules.default
|
|
];
|
|
|
|
services = {
|
|
mysql."mysql1" = {
|
|
enable = true;
|
|
|
|
initialDatabases = [
|
|
{ name = "drupal_nix_flake_example"; }
|
|
];
|
|
|
|
settings.mysqld.port = toString databasePort;
|
|
};
|
|
};
|
|
|
|
settings.processes = {
|
|
php = {
|
|
command = pkgs.writeShellApplication {
|
|
name = "php-local-server";
|
|
|
|
text = "${getExe php} -S 127.0.0.1:${toString webPort} -t web";
|
|
};
|
|
|
|
depends_on."mysql1".condition = "process_healthy";
|
|
};
|
|
};
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
inputsFrom = [
|
|
config.process-compose."default".services.outputs.devShell
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
php
|
|
phpPackages.composer
|
|
];
|
|
};
|
|
|
|
formatter = pkgs.nixfmt-rfc-style;
|
|
};
|
|
};
|
|
}
|