Drupal: Difference between revisions
m →Database Configuration: Update anchor link |
mNo edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== After Installation === | |||
After installing Drupal using nix, visit the hostname you configured in a web browser and inspect the website. If this is your first time accessing this environment, and you haven't manually imported a database, you will probably need to go through the standard Drupal UI installation process. | |||
<blockquote>'''Note:''' If you install Drupal using the UI, Drupal will make some changes to the <code>settings.php</code> file located at <code>/var/lib/drupal/<hostname>/sites/default/settings.php</code>. These changes '''will be overridden''' next time you rebuild your Drupal project from a newer source. In order to preserve these changes, make sure to add the automatically generated PHP to the <code>extraConfig</code> attribute of your configuration file. You can usually find this located at the bottom of the <code>settings.php</code> file. | |||
<syntaxhighlight lang="nix"> | |||
# Example code, do not use this directly. Instead, copy the contents at the end of your settings.php file and place them here. | |||
services.drupal.sites."localhost".extraConfig = '' | |||
// Automatically generated code from Drupal install time. | |||
$databases['default']['default'] = array ( | |||
'database' => 'drupal', | |||
'username' => 'drupal', | |||
'password' => 'drupal', | |||
'prefix' => "", | |||
'host' => 'localhost', | |||
'port' => '3306', | |||
'isolation_level' => 'READ COMMITTED', | |||
'driver' => 'mysql', | |||
'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql', | |||
'autoload' => 'core/modules/mysql/src/Driver/Database/mysql/', | |||
); | |||
''; | |||
</syntaxhighlight></blockquote> | |||
== Configuration == | == Configuration == | ||
| Line 85: | Line 110: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight><blockquote>'''Note:''' The database settings configured in NixOS will merely create the database, they will not instruct a new Drupal installation where to find the database. Either define your database settings in <code>settings.php</code>, or see [[Drupal#After_Installation| After Installation]] for an example of how to do this with nix.</blockquote> | ||
== State Directory == | == State Directory == | ||
| Line 104: | Line 129: | ||
=== Changing The Location Of The State Directory === | === Changing The Location Of The State Directory === | ||
If you want the state directory to be located in a different part of the system, you can use the following configuration to change where it is created | If you want the state directory to be located in a different part of the system, you can use the following configuration to change where it is created<syntaxhighlight lang="nix"> | ||
services.drupal.sites."localhost".stateDir = /path/to/custom/state/dir; | |||
</syntaxhighlight><blockquote>'''Note''': Changing the state directory does not automatically change the location of the <code>modules</code>, <code>themes</code>, <code>config</code>, or <code>files</code> directories. You can override those locations by using the <code>modulesDir</code> and <code>themesDir</code>, <code>configDir</code>, <code>filesDir</code> keys, accordingly.</blockquote> | |||