Signed-off-by: Anirudh Oppiliappan anirudh@tangled.org
+56
-2
nix/modules/knot.nix
+56
-2
nix/modules/knot.nix
···
51
description = "Path where repositories are scanned from";
52
};
53
54
mainBranch = mkOption {
55
type = types.str;
56
default = "main";
···
58
};
59
};
60
61
motd = mkOption {
62
type = types.nullOr types.str;
63
default = null;
···
123
description = "Jetstream endpoint to subscribe to";
124
};
125
126
dev = mkOption {
127
type = types.bool;
128
default = false;
···
190
mkdir -p "${cfg.stateDir}/.config/git"
191
cat > "${cfg.stateDir}/.config/git/config" << EOF
192
[user]
193
-
name = Git User
194
-
email = git@example.com
195
[receive]
196
advertisePushOptions = true
197
[uploadpack]
···
207
WorkingDirectory = cfg.stateDir;
208
Environment = [
209
"KNOT_REPO_SCAN_PATH=${cfg.repo.scanPath}"
210
"KNOT_REPO_MAIN_BRANCH=${cfg.repo.mainBranch}"
211
"APPVIEW_ENDPOINT=${cfg.appviewEndpoint}"
212
"KNOT_SERVER_INTERNAL_LISTEN_ADDR=${cfg.server.internalListenAddr}"
213
"KNOT_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
···
216
"KNOT_SERVER_PLC_URL=${cfg.server.plcUrl}"
217
"KNOT_SERVER_JETSTREAM_ENDPOINT=${cfg.server.jetstreamEndpoint}"
218
"KNOT_SERVER_OWNER=${cfg.server.owner}"
219
];
220
ExecStart = "${cfg.package}/bin/knot server";
221
Restart = "always";
···
51
description = "Path where repositories are scanned from";
52
};
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
+
75
mainBranch = mkOption {
76
type = types.str;
77
default = "main";
···
79
};
80
};
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
+
96
motd = mkOption {
97
type = types.nullOr types.str;
98
default = null;
···
158
description = "Jetstream endpoint to subscribe to";
159
};
160
161
+
logDids = mkOption {
162
+
type = types.bool;
163
+
default = true;
164
+
description = "Enable logging of DIDs";
165
+
};
166
+
167
dev = mkOption {
168
type = types.bool;
169
default = false;
···
231
mkdir -p "${cfg.stateDir}/.config/git"
232
cat > "${cfg.stateDir}/.config/git/config" << EOF
233
[user]
234
+
name = ${cfg.git.userName}
235
+
email = ${cfg.git.userEmail}
236
[receive]
237
advertisePushOptions = true
238
[uploadpack]
···
248
WorkingDirectory = cfg.stateDir;
249
Environment = [
250
"KNOT_REPO_SCAN_PATH=${cfg.repo.scanPath}"
251
+
"KNOT_REPO_README=${concatStringsSep "," cfg.repo.readme}"
252
"KNOT_REPO_MAIN_BRANCH=${cfg.repo.mainBranch}"
253
+
"KNOT_GIT_USER_NAME=${cfg.git.userName}"
254
+
"KNOT_GIT_USER_EMAIL=${cfg.git.userEmail}"
255
"APPVIEW_ENDPOINT=${cfg.appviewEndpoint}"
256
"KNOT_SERVER_INTERNAL_LISTEN_ADDR=${cfg.server.internalListenAddr}"
257
"KNOT_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
···
260
"KNOT_SERVER_PLC_URL=${cfg.server.plcUrl}"
261
"KNOT_SERVER_JETSTREAM_ENDPOINT=${cfg.server.jetstreamEndpoint}"
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
+
}"
273
];
274
ExecStart = "${cfg.package}/bin/knot server";
275
Restart = "always";