Update configuration files

Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-10-13 19:57:49 +01:00
parent c3113b0eec
commit 08e65f606e
27 changed files with 460 additions and 266 deletions

View file

@ -43,3 +43,5 @@
/web/themes/contrib/
/web/update.php
/web/web.config
!/web/sites/default/settings.nix.php

View file

@ -1,6 +1,9 @@
{
inputs = {
devshell.inputs.nixpkgs.follows = "nixpkgs";
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts";
import-tree.url = "github:vic/import-tree";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
process-compose.url = "github:Platonic-Systems/process-compose-flake";
services.url = "github:juspay/services-flake";
@ -10,75 +13,6 @@
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.buildEnv {
extraConfig = ''
memory_limit = 128M
'';
};
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
];
};
};
imports = [ (inputs.import-tree ./tools/nix) ];
};
}

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="drupal-nix-flake">
<description>Codestyle ruleset for drupal-nix-flake</description>
<rule ref="Drupal"/>
<rule ref="DrupalPractice"/>
<arg name="colors"/>
<arg value="np"/>
<file>web/modules/custom</file>
<rule ref="Drupal">
<exclude name="Drupal.Commenting.ClassComment.Missing"/>
<exclude name="Drupal.Commenting.DataTypeNamespace.DataTypeNamespace"/>
<exclude name="Drupal.Commenting.Deprecated"/>
<exclude name="Drupal.Commenting.DocComment.ContentAfterOpen"/>
<exclude name="Drupal.Commenting.DocComment.MissingShort"/>
<exclude name="Drupal.Commenting.FunctionComment.IncorrectParamVarName"/>
<exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
<exclude name="Drupal.Commenting.FunctionComment.InvalidReturn"/>
<exclude name="Drupal.Commenting.FunctionComment.Missing"/>
<exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
<exclude name="Drupal.Commenting.FunctionComment.ParamTypeSpaces"/>
<exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
<exclude name="Drupal.Commenting.InlineComment.DocBlock"/>
<exclude name="Drupal.Commenting.VariableComment.Missing"/>
<exclude name="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
<exclude name="DrupalPractice.Objects.StrictSchemaDisabled.StrictConfigSchema"/>
</rule>
</ruleset>

View file

@ -0,0 +1,5 @@
parameters:
level: max
paths:
- web/modules/custom

View file

@ -1,41 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutOutputDuringTests="false"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="web/core/tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
cacheResult="false"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnRisky="true"
failOnWarning="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./web/modules/*/tests/src/*</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
<env name="MINK_DRIVER_ARGS" value=""/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
<env name="MINK_DRIVER_CLASS" value=""/>
<env name="SIMPLETEST_BASE_URL" value="http://localhost:8000"/>
<env name="SIMPLETEST_DB" value="sqlite://localhost//dev/shm/test.sqlite"/>
</php>
<extensions>
<bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
<parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
<parameter name="verbose" value="true"/>
</bootstrap>
</extensions>
<testsuites>
<testsuite name="functional">
<directory suffix="Test.php">./web/modules/custom/**/tests/**/Functional</directory>
</testsuite>
<testsuite name="kernel">
<directory suffix="Test.php">./web/modules/custom/**/tests/**/Kernel</directory>
</testsuite>
<testsuite name="unit">
<directory suffix="Test.php">./web/modules/custom/**/tests/**/Unit</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -0,0 +1,31 @@
{ inputs, ... }:
{
imports = [ inputs.devshell.flakeModule ];
perSystem =
{ pkgs, ... }:
{
devshells.default =
with pkgs;
let
php = pkgs.php83.buildEnv {
extraConfig = ''
memory_limit = 128M
'';
};
phpPackages = pkgs.php83Packages;
in
{
packages = [
mariadb
php
phpPackages.composer
phpactor
pv
yamlfmt
];
};
};
}

View file

@ -0,0 +1,40 @@
{ inputs, ... }:
{
imports = [ inputs.process-compose.flakeModule ];
perSystem =
{ pkgs, ... }:
let
databasePort = 3306;
httpPort = 8888;
in
{
process-compose."default" = {
imports = [
inputs.services.processComposeModules.default
];
services = {
mysql."mysql" = {
enable = true;
initialDatabases = [
{ name = "drupal_nix_flake_example"; }
];
settings.mysqld.port = toString databasePort;
};
};
settings.processes.php = {
command = pkgs.writeShellApplication {
name = "drush-server";
text = "vendor/bin/drush runserver ${toString httpPort}";
};
depends_on."mysql".condition = "process_healthy";
};
};
};
}

View file

@ -0,0 +1,5 @@
{ inputs, ... }:
{
systems = import inputs.systems;
}

View file

@ -0,0 +1,12 @@
<?php
$databases['default']['default'] = [
'database' => 'drupal_nix_flake_example',
'username' => 'root',
'password' => '',
'host' => '127.0.0.1',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
'collation' => 'utf8mb4_general_ci',
];