-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathflake.nix
157 lines (139 loc) · 4.29 KB
/
flake.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
snow-blower.url = "github:use-the-fork/snow-blower";
};
outputs = inputs:
inputs.snow-blower.mkSnowBlower {
inherit inputs;
perSystem = {
config,
lib,
...
}: let
rootDir = config.snow-blower.paths.root;
serv = config.snow-blower.services;
lang = config.snow-blower.languages;
# Refrences PHP and Composer later in this config.
composer = "${lang.php.packages.composer}/bin/composer";
php = "${lang.php.package}/bin/php";
envKeys = builtins.attrNames config.snow-blower.env;
unsetEnv = builtins.concatStringsSep "\n" (
map (key: "unset ${key}") envKeys
);
in {
snow-blower = {
paths.src = ./.;
# Conviance scripts
scripts = {
pf.exec = ''
${unsetEnv}
./vendor/bin/pest --filter "$@"
'';
p.exec = ''
${unsetEnv}
./vendor/bin/pest
'';
coverage.exec = ''
export XDEBUG_MODE=coverage
./vendor/bin/pest --coverage
unset XDEBUG_MODE
'';
coverage-xml.exec = ''
export XDEBUG_MODE=coverage
./vendor/bin/pest --coverage --coverage-clover clover.xml
unset XDEBUG_MODE
'';
# swap a and artisan commands for testbench
a.exec = ''
${unsetEnv}
./vendor/bin/testbench "$@"
'';
artisan.exec = ''
${unsetEnv}
./vendor/bin/testbench "$@"
'';
};
languages = {
# the required version of PHP for this project.
php = {
enable = true;
version = "8.2";
extensions = ["grpc" "redis" "imagick" "memcached" "xdebug"];
ini = ''
memory_limit = 5G
max_execution_time = 90
[xdebug]
xdebug.start_with_request=yes
xdebug.start_upon_error=yes
'';
};
};
services = {
# Elasticsearch service for testing
elasticsearch = {
enable = true;
};
};
integrations = {
#Creates Changelogs based on commits
git-cliff.enable = true;
treefmt = {
settings.formatter = {
# Laravel Pint Formating
"laravel-pint" = {
command = "${php}";
options = [
"${rootDir}/vendor/bin/pint"
#make it verbose
"-v"
"--repair"
];
includes = ["*.php"];
};
};
programs = {
#Nix Formater
alejandra.enable = true;
#Format Markdown files.
mdformat.enable = true;
#JS / CSS Formatting.
prettier = {
enable = true;
settings = {
trailingComma = "es5";
semi = true;
singleQuote = true;
jsxSingleQuote = true;
bracketSpacing = true;
printWidth = 80;
tabWidth = 2;
endOfLine = "lf";
};
};
};
};
# Guess what this does. Go ahead Guess.
git-hooks.hooks = {
# run formatting on files that are being commited
treefmt.enable = true;
# Code linting
phpstan.enable = false;
#lets make sure there are no keys in the repo
detect-private-keys.enable = true;
#fix line endings.
mixed-line-endings.enable = true;
};
};
shell.interactive = [
''
if [[ ! -d vendor ]]; then
${composer} install
fi
''
];
};
};
};
}