+56
-2
nix/modules/knot.nix
+56
-2
nix/modules/knot.nix
···
51
51
description = "Path where repositories are scanned from";
52
52
};
53
53
54
+
readme = mkOption {
55
+
type = types.listOf types.str;
56
+
default = [
57
+
"README.md"
58
+
"readme.md"
59
+
"README"
60
+
"readme"
61
+
"README.markdown"
62
+
"readme.markdown"
63
+
"README.txt"
64
+
"readme.txt"
65
+
"README.rst"
66
+
"readme.rst"
67
+
"README.org"
68
+
"readme.org"
69
+
"README.asciidoc"
70
+
"readme.asciidoc"
71
+
];
72
+
description = "List of README filenames to look for (in priority order)";
73
+
};
74
+
54
75
mainBranch = mkOption {
55
76
type = types.str;
56
77
default = "main";
···
58
79
};
59
80
};
60
81
82
+
git = {
83
+
userName = mkOption {
84
+
type = types.str;
85
+
default = "Tangled";
86
+
description = "Git user name used as committer";
87
+
};
88
+
89
+
userEmail = mkOption {
90
+
type = types.str;
91
+
default = "noreply@tangled.org";
92
+
description = "Git user email used as committer";
93
+
};
94
+
};
95
+
61
96
motd = mkOption {
62
97
type = types.nullOr types.str;
63
98
default = null;
···
123
158
description = "Jetstream endpoint to subscribe to";
124
159
};
125
160
161
+
logDids = mkOption {
162
+
type = types.bool;
163
+
default = true;
164
+
description = "Enable logging of DIDs";
165
+
};
166
+
126
167
dev = mkOption {
127
168
type = types.bool;
128
169
default = false;
···
190
231
mkdir -p "${cfg.stateDir}/.config/git"
191
232
cat > "${cfg.stateDir}/.config/git/config" << EOF
192
233
[user]
193
-
name = Git User
194
-
email = git@example.com
234
+
name = ${cfg.git.userName}
235
+
email = ${cfg.git.userEmail}
195
236
[receive]
196
237
advertisePushOptions = true
197
238
[uploadpack]
···
207
248
WorkingDirectory = cfg.stateDir;
208
249
Environment = [
209
250
"KNOT_REPO_SCAN_PATH=${cfg.repo.scanPath}"
251
+
"KNOT_REPO_README=${concatStringsSep "," cfg.repo.readme}"
210
252
"KNOT_REPO_MAIN_BRANCH=${cfg.repo.mainBranch}"
253
+
"KNOT_GIT_USER_NAME=${cfg.git.userName}"
254
+
"KNOT_GIT_USER_EMAIL=${cfg.git.userEmail}"
211
255
"APPVIEW_ENDPOINT=${cfg.appviewEndpoint}"
212
256
"KNOT_SERVER_INTERNAL_LISTEN_ADDR=${cfg.server.internalListenAddr}"
213
257
"KNOT_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
···
216
260
"KNOT_SERVER_PLC_URL=${cfg.server.plcUrl}"
217
261
"KNOT_SERVER_JETSTREAM_ENDPOINT=${cfg.server.jetstreamEndpoint}"
218
262
"KNOT_SERVER_OWNER=${cfg.server.owner}"
263
+
"KNOT_SERVER_LOG_DIDS=${
264
+
if cfg.server.logDids
265
+
then "true"
266
+
else "false"
267
+
}"
268
+
"KNOT_SERVER_DEV=${
269
+
if cfg.server.dev
270
+
then "true"
271
+
else "false"
272
+
}"
219
273
];
220
274
ExecStart = "${cfg.package}/bin/knot server";
221
275
Restart = "always";