Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

nix: appview project mode and custom templates

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>

Anirudh Oppiliappan (May 14, 2026, 1:44 PM +0300) db54e251 9829792e

+56 -2
+43 -2
nix/modules/appview.nix
··· 6 6 }: let 7 7 cfg = config.services.tangled.appview; 8 8 in 9 - with lib; { 9 + with lib; let 10 + effectivePackage = 11 + if cfg.project.templatesDir == null 12 + then cfg.package 13 + else cfg.package.override {customTemplatesDir = cfg.project.templatesDir;}; 14 + in { 10 15 options = { 11 16 services.tangled.appview = { 12 17 enable = mkOption { ··· 232 237 }; 233 238 }; 234 239 240 + project = { 241 + enable = mkOption { 242 + type = types.bool; 243 + default = false; 244 + description = "Enable project mode: collapses URL namespace to a single user, disables signup and timeline."; 245 + }; 246 + 247 + user = mkOption { 248 + type = types.str; 249 + default = ""; 250 + example = "anirudh.fi"; 251 + description = "The handle or DID of the project user. Required when project.enable is true."; 252 + }; 253 + 254 + templatesDir = mkOption { 255 + type = types.nullOr types.path; 256 + default = null; 257 + example = "./custom-templates"; 258 + description = '' 259 + Path to a directory of template overrides. Files are copied on 260 + top of the default templates at build time, so individual 261 + templates can be replaced without forking the whole tree. 262 + ''; 263 + }; 264 + }; 265 + 235 266 environmentFile = mkOption { 236 267 type = with types; nullOr path; 237 268 default = null; ··· 255 286 }; 256 287 257 288 config = mkIf cfg.enable { 289 + assertions = [ 290 + { 291 + assertion = !cfg.project.enable || cfg.project.user != ""; 292 + message = "services.tangled.appview.project.user must be set when project.enable is true"; 293 + } 294 + ]; 258 295 services.redis.servers.appview = { 259 296 enable = true; 260 297 port = 6379; ··· 271 308 272 309 serviceConfig = { 273 310 Type = "simple"; 274 - ExecStart = "${cfg.package}/bin/appview"; 311 + ExecStart = "${effectivePackage}/bin/appview"; 275 312 Restart = "always"; 276 313 RestartSec = "10s"; 277 314 EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile; ··· 335 372 336 373 TANGLED_LABEL_DEFAULTS = concatStringsSep "," cfg.label.defaults; 337 374 TANGLED_LABEL_GFI = cfg.label.goodFirstIssue; 375 + } 376 + // optionalAttrs cfg.project.enable { 377 + TANGLED_PROJECT_MODE = "true"; 378 + TANGLED_PROJECT_USER = cfg.project.user; 338 379 }; 339 380 }; 340 381 };
+12
nix/pkgs/appview.nix
··· 4 4 appview-static-files, 5 5 sqlite-lib, 6 6 src, 7 + # optional path to a directory of template overrides; files here are 8 + # copied on top of appview/pages/templates/ before the Go embed runs, 9 + # so any template file can be replaced without forking the whole tree. 10 + customTemplatesDir ? null, 7 11 }: 8 12 buildGoApplication { 9 13 pname = "appview"; ··· 14 18 pushd source 15 19 mkdir -p appview/pages/static 16 20 cp -frv ${appview-static-files}/* appview/pages/static 21 + ${ 22 + if customTemplatesDir != null 23 + then '' 24 + echo "overlaying custom templates from ${customTemplatesDir}" 25 + cp -rfv ${customTemplatesDir}/* appview/pages/templates/ 26 + '' 27 + else "" 28 + } 17 29 popd 18 30 ''; 19 31
+1
nix/vm.nix
··· 155 155 }; 156 156 services.tangled.knotmirror = { 157 157 enable = true; 158 + knotSSRF = false; 158 159 listenAddr = "0.0.0.0:7000"; 159 160 metricsListenAddr = "0.0.0.0:7100"; 160 161 adminListenAddr = "0.0.0.0:7200";