-
Notifications
You must be signed in to change notification settings - Fork 0
/
devenv.nix
123 lines (110 loc) · 3.56 KB
/
devenv.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{ pkgs, lib, config, ... }:
{
packages = [
pkgs.jq
pkgs.gnupatch
pkgs.yarn
pkgs.symfony-cli
];
languages.javascript = {
enable = lib.mkDefault true;
package = lib.mkDefault pkgs.nodejs-18_x;
};
languages.php = {
enable = lib.mkDefault true;
version = lib.mkDefault "8.2";
extensions = [ "xdebug" ];
ini = ''
xdebug.mode = debug
xdebug.discover_client_host = 1
xdebug.client_host = 127.0.0.1
memory_limit = 2G
realpath_cache_ttl = 3600
session.gc_probability = 0
${lib.optionalString config.services.redis.enable ''
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379/0"
''}
display_errors = On
error_reporting = E_ALL
assert.active = 0
opcache.memory_consumption = 256M
opcache.interned_strings_buffer = 20
zend.assertions = 0
short_open_tag = 0
zend.detect_unicode = 0
realpath_cache_ttl = 3600
'';
fpm.pools.web = lib.mkDefault {
settings = {
"clear_env" = "no";
"pm" = "dynamic";
"pm.max_children" = 10;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 10;
};
};
};
services.caddy = {
enable = lib.mkDefault true;
virtualHosts.":8000" = lib.mkDefault {
extraConfig = ''
root * project/public
php_fastcgi unix/${config.languages.php.fpm.pools.web.socket}
encode zstd gzip
file_server
log {
output stderr
format console
level ERROR
}
'';
};
};
services.mysql = {
enable = true;
package = pkgs.mysql80;
initialDatabases = lib.mkDefault [{ name = "symfony"; }];
ensureUsers = lib.mkDefault [
{
name = "symfony";
password = "symfony";
ensurePermissions = {
"symfony.*" = "ALL PRIVILEGES";
"symfony_test.*" = "ALL PRIVILEGES";
};
}
];
settings = {
mysqld = {
log_bin_trust_function_creators = 1;
};
};
};
services.redis.enable = lib.mkDefault true;
services.mailhog.enable = lib.mkDefault true;
#services.rabbitmq.enable = true;
#services.rabbitmq.managementPlugin.enable = true;
#services.elasticsearch.enable = true;
# Environment variables
env.MAILER_DSN = lib.mkDefault "smtp://localhost:1025";
env.DATABASE_URL = lib.mkDefault "mysql://symfony:symfony@localhost:3306/symfony";
# Shopware 6 related scripts
scripts.build-js.exec = lib.mkDefault "./project/bin/build-js.sh";
scripts.build-storefront.exec = lib.mkDefault "./project/bin/build-storefront.sh";
scripts.watch-storefront.exec = lib.mkDefault "./project/bin/watch-storefront.sh";
scripts.build-administration.exec = lib.mkDefault "./project/bin/build-administration.sh";
scripts.watch-administration.exec = lib.mkDefault "./project/bin/watch-administration.sh";
scripts.theme-refresh.exec = lib.mkDefault "./project/bin/console theme-refresh";
scripts.theme-compile.exec = lib.mkDefault "./project/bin/console theme-compile";
# Symfony related scripts
scripts.cc.exec = lib.mkDefault "./project/bin/console cache:clear";
scripts.sw-dev.exec = ''
composer create-project shopware/production project
cd ./project
composer req --dev dev-tools symfony/var-dumper symfony/web-profiler-bundle maltyxx/images-generator mbezhanov/faker-provider-collection frosh/development-helper frosh/tools
bin/console system:install --basic-setup
'';
scripts.clean.exec = "rm -Rf ./project && rm -Rf ./.devenv";
}