Extract web dev into own functions for better maintenance

Use a function for static files and TYPO3 that can be called.
That way I separate the actual domains for development from the
definition.
This commit is contained in:
Daniel Siepmann 2023-02-07 13:53:54 +01:00
parent 813cba39bb
commit b2e3f46643
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
7 changed files with 39 additions and 14 deletions

View file

@ -3,12 +3,13 @@
{
imports = [
./mkcert.nix
./lib/mkcert.nix
./static-files.nix
./mailhog.localhost.nix
./domains/mailhog.localhost.nix
./daniel-siepmann.localhost.nix
./domains/tea-docs.typo3.localhost.nix
./domains/daniel-siepmann.localhost.nix
];

View file

@ -0,0 +1,10 @@
{ pkgs, lib, config, ... }:
import ./../lib/create-typo3.nix {
inherit config lib pkgs;
domain = "daniel-siepmann.localhost";
relativeDocumentRoot = "own/daniel-siepmann.de/project/public/";
databaseName = "own_danielsiepmann";
phpPackage = pkgs.php82;
}

View file

@ -0,0 +1,8 @@
{ lib, config, ... }:
import ./../lib/create-static.nix {
inherit config;
domain = "tea-docs.typo3.localhost";
relativeDocumentRoot = "typo3/tea/Documentation-GENERATED-temp/Result/project/0.0.0/";
}

View file

@ -1,8 +1,11 @@
{ pkgs, lib, config, ... }:
{
config
, domain
, relativeDocumentRoot
}:
let
domain = "tea-docs.typo3.localhost";
documentRoot = "${config.custom.web-development.rootPath}/typo3/tea/Documentation-GENERATED-temp/Result/project/0.0.0/";
documentRoot = "${config.custom.web-development.rootPath}/${relativeDocumentRoot}";
in {
services = {

View file

@ -1,16 +1,19 @@
{ pkgs, lib, config, ... }:
{
config
, lib
, pkgs
, domain
, relativeDocumentRoot
, databaseName
, phpPackage
}:
# TODO: Move to template / function and call with variables
let
domain = "daniel-siepmann.localhost";
documentRoot = "${config.custom.web-development.rootPath}/own/daniel-siepmann.de/project/public/";
databaseName = "own_danielsiepmann";
phpPackage = pkgs.php82;
documentRoot = "${config.custom.web-development.rootPath}/${relativeDocumentRoot}";
in {
services = {
httpd.virtualHosts.${domain} = {
forceSSL = true;
sslServerCert = "${config.custom.web-development.certFolder}${domain}.pem";
sslServerKey = "${config.custom.web-development.certFolder}${domain}-key.pem";