Signed-off-by: Anirudh Oppiliappan anirudh@tangled.org
+48
-2
nix/modules/knot.nix
+48
-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.sh";
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
EOF
···
205
246
WorkingDirectory = cfg.stateDir;
206
247
Environment = [
207
248
"KNOT_REPO_SCAN_PATH=${cfg.repo.scanPath}"
249
+
"KNOT_REPO_README=${concatStringsSep "," cfg.repo.readme}"
208
250
"KNOT_REPO_MAIN_BRANCH=${cfg.repo.mainBranch}"
251
+
"KNOT_GIT_USER_NAME=${cfg.git.userName}"
252
+
"KNOT_GIT_USER_EMAIL=${cfg.git.userEmail}"
209
253
"APPVIEW_ENDPOINT=${cfg.appviewEndpoint}"
210
254
"KNOT_SERVER_INTERNAL_LISTEN_ADDR=${cfg.server.internalListenAddr}"
211
255
"KNOT_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
···
214
258
"KNOT_SERVER_PLC_URL=${cfg.server.plcUrl}"
215
259
"KNOT_SERVER_JETSTREAM_ENDPOINT=${cfg.server.jetstreamEndpoint}"
216
260
"KNOT_SERVER_OWNER=${cfg.server.owner}"
261
+
"KNOT_SERVER_LOG_DIDS=${if cfg.server.logDids then "true" else "false"}"
262
+
"KNOT_SERVER_DEV=${if cfg.server.dev then "true" else "false"}"
217
263
];
218
264
ExecStart = "${cfg.package}/bin/knot server";
219
265
Restart = "always";