add searx and fix caddy cloudflare stuff

This commit is contained in:
cy 2025-03-08 17:23:27 -05:00
parent 72303fd21c
commit f8ac4c667d
Signed by: cy
SSH key fingerprint: SHA256:o/geVWV4om1QhUSkKvDQeW/eAihwnjyXkqMwrVdbuts
8 changed files with 85 additions and 7 deletions

View file

@ -29,11 +29,12 @@ in
(common) {
encode zstd gzip
header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
tls {
dns cloudflare {$CLOUDFLARE_KEY}
resolvers 1.1.1.1 8.8.8.8
}
}
'';
globalConfig = ''
acme_dns cloudflare {$CLOUDFLARE_KEY}
'';
environmentFile = config.sops.secrets."caddy/env".path;
};
};

View file

@ -7,5 +7,6 @@
./zipline.nix
./containerization.nix
./vaultwarden.nix
./searx.nix
];
}

35
modules/searx.nix Normal file
View file

@ -0,0 +1,35 @@
{
config,
lib,
...
}:
let
cfg = config.my.searx;
sockPath = "/run/searx/searx.sock";
in
{
options.my.searx = {
enable = lib.mkEnableOption "searx";
};
config = lib.mkIf cfg.enable {
services.searx = {
enable = true;
runInUwsgi = true;
uwsgiConfig = {
disable-logging = true;
http = "127.0.0.1:8090";
};
settings = {
# get secret from env
server.secret_key = "@SEARX_SECRET_KEY@";
};
environmentFile = config.sops.secrets."searx/env".path;
};
services.caddy.virtualHosts."x.cy7.sh".extraConfig = ''
import common
reverse_proxy 127.0.0.1:8090
'';
};
}