Move all files to drupal-nix-flake/
This commit is contained in:
parent
2f08b5a081
commit
04d7f09b61
14 changed files with 0 additions and 0 deletions
1
drupal-nix-flake/.envrc
Normal file
1
drupal-nix-flake/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake .
|
7
drupal-nix-flake/.gitignore
vendored
Normal file
7
drupal-nix-flake/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
.editorconfig
|
||||
.gitattributes
|
||||
data/
|
||||
recipes/README.txt
|
||||
vendor/
|
||||
web/
|
||||
web/core/
|
8
drupal-nix-flake/.tmux-sessionizer
Executable file
8
drupal-nix-flake/.tmux-sessionizer
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
tmux new-window -dn scratch
|
||||
tmux new-window -dn server
|
||||
|
||||
tmux send-keys -t server "nix run" Enter
|
||||
|
||||
nvim .
|
14
drupal-nix-flake/README.md
Normal file
14
drupal-nix-flake/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# drupal-nix-flake-example
|
||||
|
||||
Run `nix run` to start the project.
|
||||
|
||||
Run `nix develop` to enter the dev shell to access PHP and Composer, or use direnv.
|
||||
|
||||
Install Drupal:
|
||||
|
||||
drush site:install --db-url=mysql://root@127.0.0.1/drupal_nix_flake_example
|
||||
|
||||
Add `drupal/core-dev` to run tests:
|
||||
|
||||
composer require --dev drupal/core-dev
|
||||
|
107
drupal-nix-flake/composer.json
Normal file
107
drupal-nix-flake/composer.json
Normal file
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
"name": "drupal/recommended-project",
|
||||
"description": "Project template for Drupal projects with a relocated document root",
|
||||
"type": "project",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"homepage": "https://www.drupal.org/project/drupal",
|
||||
"support": {
|
||||
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
|
||||
"chat": "https://www.drupal.org/node/314178"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://packages.drupal.org/8"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "^2.3",
|
||||
"drupal/core-composer-scaffold": "^11.1",
|
||||
"drupal/core-project-message": "^11.1",
|
||||
"drupal/core-recommended": "^11.1",
|
||||
"drush/drush": "^13.6"
|
||||
},
|
||||
"conflict": {
|
||||
"drupal/drupal": "*"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/installers": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"drupal/core-composer-scaffold": true,
|
||||
"drupal/core-project-message": true,
|
||||
"php-http/discovery": true,
|
||||
"phpstan/extension-installer": true,
|
||||
"tbachert/spi": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"drupal-scaffold": {
|
||||
"locations": {
|
||||
"web-root": "web/"
|
||||
}
|
||||
},
|
||||
"installer-paths": {
|
||||
"web/core": [
|
||||
"type:drupal-core"
|
||||
],
|
||||
"web/libraries/{$name}": [
|
||||
"type:drupal-library"
|
||||
],
|
||||
"web/modules/contrib/{$name}": [
|
||||
"type:drupal-module"
|
||||
],
|
||||
"web/profiles/contrib/{$name}": [
|
||||
"type:drupal-profile"
|
||||
],
|
||||
"web/themes/contrib/{$name}": [
|
||||
"type:drupal-theme"
|
||||
],
|
||||
"drush/Commands/contrib/{$name}": [
|
||||
"type:drupal-drush"
|
||||
],
|
||||
"web/modules/custom/{$name}": [
|
||||
"type:drupal-custom-module"
|
||||
],
|
||||
"web/profiles/custom/{$name}": [
|
||||
"type:drupal-custom-profile"
|
||||
],
|
||||
"web/themes/custom/{$name}": [
|
||||
"type:drupal-custom-theme"
|
||||
],
|
||||
"recipes/{$name}": [
|
||||
"type:drupal-recipe"
|
||||
]
|
||||
},
|
||||
"drupal-core-project-message": {
|
||||
"include-keys": [
|
||||
"homepage",
|
||||
"support"
|
||||
],
|
||||
"post-create-project-cmd-message": [
|
||||
"<bg=blue;fg=white> </>",
|
||||
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
|
||||
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
|
||||
"<bg=blue;fg=white> </>",
|
||||
"",
|
||||
"<bg=yellow;fg=black>Next steps</>:",
|
||||
" * Install the site: https://www.drupal.org/docs/installing-drupal",
|
||||
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
|
||||
" * Get support: https://www.drupal.org/support",
|
||||
" * Get involved with the Drupal community:",
|
||||
" https://www.drupal.org/getting-involved",
|
||||
" * Remove the plugin that prints this message:",
|
||||
" composer remove drupal/core-project-message"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"drupal/core-dev": "^11.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test" : "phpunit --testdox"
|
||||
}
|
||||
}
|
11617
drupal-nix-flake/composer.lock
generated
Normal file
11617
drupal-nix-flake/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
109
drupal-nix-flake/flake.lock
generated
Normal file
109
drupal-nix-flake/flake.lock
generated
Normal file
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1744868846,
|
||||
"narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ebe4301cbd8f81c4f8d3244b3632338bbeb6d49c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1743296961,
|
||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"process-compose": {
|
||||
"locked": {
|
||||
"lastModified": 1740324671,
|
||||
"narHash": "sha256-djc+wRG9L70jlW95Ck4GKr7nTPp1drfsXshJkYZAd9s=",
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "process-compose-flake",
|
||||
"rev": "2a17e49b8a5d32278ed77e4a881f992472be18a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Platonic-Systems",
|
||||
"repo": "process-compose-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"process-compose": "process-compose",
|
||||
"services": "services",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"locked": {
|
||||
"lastModified": 1745109634,
|
||||
"narHash": "sha256-RO63ip09eIbLw2j1VV0xwtoRomQgopdp9v+VIYQ6AII=",
|
||||
"owner": "juspay",
|
||||
"repo": "services-flake",
|
||||
"rev": "f308c7ed80043474d06b85fe55d1f1381421872a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "juspay",
|
||||
"repo": "services-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
82
drupal-nix-flake/flake.nix
Normal file
82
drupal-nix-flake/flake.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
41
drupal-nix-flake/phpunit.xml.dist
Normal file
41
drupal-nix-flake/phpunit.xml.dist
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
beStrictAboutChangesToGlobalState="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
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"
|
||||
>
|
||||
<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>
|
||||
</phpunit>
|
0
drupal-nix-flake/recipes/.keep
Normal file
0
drupal-nix-flake/recipes/.keep
Normal file
3
drupal-nix-flake/web/modules/example/example.info.yml
Normal file
3
drupal-nix-flake/web/modules/example/example.info.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
name: Example
|
||||
type: module
|
||||
core_version_requirement: ^11
|
7
drupal-nix-flake/web/modules/example/example.routing.yml
Normal file
7
drupal-nix-flake/web/modules/example/example.routing.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
example.page:
|
||||
path: /example
|
||||
defaults:
|
||||
_controller: Drupal\example\Controller\ExamplePageController
|
||||
methods: [GET]
|
||||
requirements:
|
||||
_permission: access content
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\example\Controller;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
final class ExamplePageController {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
public function __invoke(): array {
|
||||
return [
|
||||
'#markup' => $this->t('This page is powered by Drupal and Nix.'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\example\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
class ExampleTest extends BrowserTestBase {
|
||||
|
||||
public $defaultTheme = 'stark';
|
||||
|
||||
public static $modules = [
|
||||
'example',
|
||||
'node',
|
||||
];
|
||||
|
||||
public function test_it_loads_the_page(): void {
|
||||
$this->drupalGet('/example');
|
||||
|
||||
$assert = $this->assertSession();
|
||||
|
||||
$assert->statusCodeEquals(200);
|
||||
$assert->pageTextContains('This page is powered by Drupal and Nix.');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue