all repos — nixfiles @ 92fdbb33336edfb9b846b0930170c46aa0c58056

System and user configuration, managed by nix and home-manager

add searchix-stable-container to smrk

Alin
commit

92fdbb33336edfb9b846b0930170c46aa0c58056

parent

f31b63ac610c943cae43ea15a6dc9910099b4f92

2 files changed, 113 insertions(+), 0 deletions(-)

changed files
M system/hosts/smrk.nix → system/hosts/smrk.nix
@@ -28,6 +28,7 @@ ../roles/readeck.nix
../roles/redis-website.nix ../roles/paperless.nix ../roles/searchix.nix + ../roles/searchix-stable-container.nix ../roles/sso.nix ../roles/subdomain-redirector.nix ../roles/video-library.nix
A system/roles/searchix-stable-container.nix
@@ -0,0 +1,112 @@
+{ + config, + inputs, + pkgs, + ... +}: +let + stableVersion = "25.11"; +in +{ + imports = [ + ../../packages/modules/nixos/goaccess.nix + ]; + + containers.searchix-stable = { + autoStart = true; + config = { + imports = [ + inputs.searchix.nixosModules.web + ]; + + system.stateVersion = "25.11"; + + services.searchix = { + enable = true; + environment = { + GOMEMLIMIT = "1000MiB"; + }; + settings = { + web = { + baseURL = "https://stable.searchix.ovh"; + port = 51314; + }; + + importer = { + timeout = "45m"; + updateAt = "07:00:00"; + batchSize = 2000; + sources = { + nixpkgs = { + enable = true; + fetcher = "channel-nixpkgs"; + channel = "nixos-${stableVersion}"; + timeout = "30m"; + manpages = { + enable = true; + path = "/doc/manpage-urls.json"; + }; + }; + nixos = { + enable = true; + fetcher = "channel-nixpkgs"; + channel = "nixos-${stableVersion}"; + }; + }; + }; + }; + }; + }; + }; + + services.caddy.virtualHosts = { + "stable.searchix.ovh" = { + extraConfig = '' + root ${pkgs.searchix}/lib/searchix + handle_errors { + rewrite * /error.html + templates + file_server + } + handle_path /stats/* { + root /srv/http/access/searchix-stable + file_server + } + handle { + reverse_proxy localhost:51314 { + health_uri /health + health_status 2xx + } + } + encode zstd gzip { + match { + header Content-Type text/* + header Content-Type application/json* + header Content-Type application/javascript* + header Content-Type application/opensearchdescription+xml + header Content-Type application/atom+xml* + header Content-Type application/rss+xml* + header Content-Type image/svg+xml* + } + } + ''; + }; + }; + + services.goaccess.instances = { + stable-searchix = { + enable = true; + dates = "daily"; + settings = { + log-file = "${config.services.caddy.logDir}/access-stable.searchix.ovh.log"; + output = "/srv/http/access/searchix-stable/index.html"; + log-format = "caddy"; + anonymize-ip = true; + anonymize-level = 2; + persist = true; + restore = true; + keep-last = 90; # days + }; + }; + }; +}