-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathflake.nix
178 lines (159 loc) · 4.9 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{
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: let
pkgs = import inputs.nixpkgs {
# Add overlay here to inject the mkdocs-material and extensions plugin
nixpkgs.overlays = self: super: {
mkdocs = super.mkdocs.override {
propogatedBuildInputs =
[super.mkdocs.propogatedBuildInputs]
++ pkgs.python312Packages.mkdocs-material
++ pkgs.python312Packages.mkdocs-material-extensions;
};
};
};
in
inputs.snow-blower.mkSnowBlower {
inherit inputs;
perSystem = {
config,
lib,
pkgs,
...
}: let
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";
publicKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOSE69dmDxQ/UJ8k+8CL3lzc/PyJXXO/2aCcYQOjkTW+ " #Greg Home Machine
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBheo89VICojUMhqeSykFVEBoO0R+kKwlFxkS4DZ+NER" #Greg
];
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
'';
# swap a and artisan commands for testbench
a.exec = ''
${unsetEnv}
./vendor/bin/testbench "$@"
'';
artisan.exec = ''
${unsetEnv}
./vendor/bin/testbench "$@"
'';
};
processes = {
};
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
'';
};
javascript.enable = true;
javascript.npm.enable = true;
};
services = {
aider.enable = true;
};
integrations = {
#secrets
agenix = {
enable = true;
secrets = {
".env" = {inherit publicKeys;};
};
};
#Creates Changelogs based on commits
git-cliff.enable = true;
treefmt = {
settings.formatter = {
"pint" = {
command = "${composer}";
options = [
"lint"
];
includes = ["*.php"];
};
"refactor-file" = {
command = "${composer}";
options = [
"refactor-file"
"--"
"--debug"
"process"
];
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;
#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
''
];
};
};
};
}