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