-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_neosFlowConfig.nix
74 lines (66 loc) · 1.85 KB
/
_neosFlowConfig.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Module: Neos/Flow Config Settings.yaml generation
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.neos;
yamlFormatter = pkgs.formats.yaml {};
######################
# Neos/Flow configuration
######################
ConfigurationSettings = {
Neos = {
Flow = {
persistence = {
backendOptions = {
driver = "pdo_mysql";
charset = "utf8mb4";
host = "127.0.0.1";
port = toString config.services.mysql.settings.mysqld.port;
user = (head config.services.mysql.ensureUsers).name;
# no password configured
# password = "password";
dbname = (head config.services.mysql.initialDatabases).name;
};
};
};
# if VIPS is configured, also add it to the config.
# // merges two attribute-sets (non-recursively)
} // (optionalAttrs cfg.vips {
Imagine = {
driver = "Vips";
enabledDrivers = {
Vips = true;
Gd = true;
Imagick = true;
};
};
Media = {
image = {
defaultOptions = {
# The Vips driver does not support interlace
interlace = null;
};
};
};
});
};
ConfigurationSettingsYaml = yamlFormatter.generate "Settings.yaml" ConfigurationSettings;
in
{
config = lib.mkIf cfg.enable {
# Setup and Documentation
enterShell = ''
${if cfg.flowConfig then ''
mkdir -p ./${cfg.distributionDir}/Configuration
cp ${ConfigurationSettingsYaml} ./${cfg.distributionDir}/Configuration/Settings.yaml
chmod 644 ./${cfg.distributionDir}/Configuration/Settings.yaml
'' else ""}
'';
scripts.flow.exec = ''
olddir=`pwd`
cd ${config.env.DEVENV_ROOT}/${cfg.distributionDir}
./flow $@
cd "$olddir"
'';
};
}