2023-02-05 14:11:22 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
2023-03-08 08:35:20 +01:00
|
|
|
let
|
2023-02-05 14:11:22 +01:00
|
|
|
|
2023-03-08 08:35:20 +01:00
|
|
|
mysqlEnsurePermissionsForDevUser = builtins.listToAttrs (
|
|
|
|
map (databaseName: {
|
|
|
|
name = "${databaseName}.*";
|
|
|
|
value = "ALL PRIVILEGES";
|
|
|
|
})
|
|
|
|
config.custom.web-development.databases
|
|
|
|
);
|
2023-02-05 14:11:22 +01:00
|
|
|
|
2023-03-08 08:35:20 +01:00
|
|
|
in {
|
|
|
|
imports = [
|
2023-02-07 13:53:54 +01:00
|
|
|
|
2023-03-08 08:35:20 +01:00
|
|
|
./lib/mkcert.nix
|
2023-02-07 08:57:10 +01:00
|
|
|
|
2023-03-08 08:35:20 +01:00
|
|
|
./projects/private.nix
|
|
|
|
./projects/service-wrapper.nix
|
|
|
|
./projects/typo3.nix
|
|
|
|
./projects/customer.nix
|
2023-02-07 17:50:31 +01:00
|
|
|
|
2023-02-05 14:11:22 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
options = {
|
2023-02-07 08:57:10 +01:00
|
|
|
|
2023-02-05 14:11:22 +01:00
|
|
|
custom.web-development = {
|
|
|
|
rootPath = lib.mkOption {
|
|
|
|
type = lib.types.path;
|
|
|
|
default = "/var/projects";
|
2023-03-08 08:35:20 +01:00
|
|
|
description = ''
|
|
|
|
The root folder where web development happens.
|
|
|
|
All Projects need to be placed within this folder.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
databases = lib.mkOption {
|
2023-10-08 16:46:33 +02:00
|
|
|
type = lib.types.listOf lib.types.nonEmptyStr;
|
2023-03-08 08:35:20 +01:00
|
|
|
default = [];
|
|
|
|
example = lib.literalExpression "[namespace_project namespace2_project1]";
|
|
|
|
description = ''
|
|
|
|
A list of all necessary databases.
|
|
|
|
Used to create the databases and grant permissions.
|
|
|
|
'';
|
2023-02-05 14:11:22 +01:00
|
|
|
};
|
|
|
|
};
|
2023-02-07 08:57:10 +01:00
|
|
|
|
2023-02-05 14:11:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
|
|
services = {
|
|
|
|
httpd = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
user = "daniels";
|
|
|
|
|
|
|
|
adminAddr = "apache@hikari.localhost";
|
|
|
|
|
|
|
|
extraModules = [
|
|
|
|
"info"
|
|
|
|
"rewrite"
|
|
|
|
"proxy"
|
|
|
|
"proxy_fcgi"
|
|
|
|
];
|
|
|
|
|
|
|
|
virtualHosts."localhost".locations."/server-info" = {
|
|
|
|
extraConfig = ''
|
|
|
|
SetHandler server-info
|
|
|
|
Require local
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mysql = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
package = pkgs.mariadb;
|
|
|
|
|
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "daniels";
|
|
|
|
ensurePermissions = {
|
|
|
|
"*.*" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# INITIALLY once change dev user to be identified by password
|
2023-02-18 11:23:04 +01:00
|
|
|
# alter user dev@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('dev');
|
2023-02-05 14:11:22 +01:00
|
|
|
name = "dev";
|
2023-03-08 08:35:20 +01:00
|
|
|
ensurePermissions = mysqlEnsurePermissionsForDevUser;
|
2023-02-05 14:11:22 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
ensureDatabases = [
|
|
|
|
"testing" # Used by TYPO3 functional tests
|
|
|
|
"testing_at" # Used by TYPO3 Acceptance tests
|
2023-03-08 08:35:20 +01:00
|
|
|
] ++ config.custom.web-development.databases;
|
2023-02-05 14:11:22 +01:00
|
|
|
|
|
|
|
settings = {
|
|
|
|
mysqld = {
|
|
|
|
# sql_mode = "SRTICT_TRANS_TABLES;NO_ZERO_IN_DATE;NO_ZERO_DATE;ERROR_FOR_DIVISION_BY_ZERO;NO_ENGINE_SUBSTITUTION";
|
|
|
|
general_log = true;
|
|
|
|
general_log_file = "/var/lib/mysql/query.log";
|
|
|
|
|
2023-12-07 19:21:25 +01:00
|
|
|
# slow_query_log = true;
|
|
|
|
# slow_query_log_file = "/var/lib/mysql/slow_query.log";
|
|
|
|
# long_query_time = 1;
|
|
|
|
|
2023-02-05 14:11:22 +01:00
|
|
|
bind-address = "127.0.0.1";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
2023-03-08 09:16:46 +01:00
|
|
|
# TODO: Improve handling of TYPO3 global configuration
|
|
|
|
# Current issue: The files are copied once.
|
2023-02-05 14:11:22 +01:00
|
|
|
# Changes are not reflected until reboot?
|
2023-03-08 09:16:46 +01:00
|
|
|
# I can edit the copied files, but need to keep files in sync.
|
|
|
|
"C ${config.custom.web-development.rootPath}/own/typo3-configuration - - - - ${config.users.users.daniels.home}/.config/nixpkgs/home/files/typo3-configuration"
|
2023-02-05 14:11:22 +01:00
|
|
|
];
|
2023-02-07 08:57:10 +01:00
|
|
|
|
2023-02-05 14:11:22 +01:00
|
|
|
};
|
|
|
|
}
|