drupal-nix-flake-example/flake.nix

83 lines
1.9 KiB
Nix
Raw Permalink Normal View History

2025-04-23 20:35:36 +01:00
{
2025-04-23 20:48:20 +01:00
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";
};
2025-04-23 20:35:36 +01:00
outputs =
2025-04-23 20:48:20 +01:00
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;
};
2025-04-23 20:35:36 +01:00
};
}