Change host

searx vhost still not working
This commit is contained in:
muon 2024-12-01 10:22:10 +00:00
parent 784c5dfdad
commit 4b3808c042
6 changed files with 71 additions and 53 deletions

View file

@ -30,8 +30,8 @@ in with lib; {
# udev 250 doesn't reliably reinitialize devices after restart
systemd.services.systemd-udevd.restartIfChanged = false;
systemd.services.NetworkManager-wait-online.enable = lib.mkForce false;
systemd.services.systemd-networkd-wait-online.enable = lib.mkForce false;
# systemd.services.NetworkManager-wait-online.enable = lib.mkForce false;
# systemd.services.systemd-networkd-wait-online.enable = lib.mkForce false;
services.tailscale.enable = cfg.tailscale.enable;

View file

@ -1,27 +1,50 @@
{ pkgs, lib, config, ... }: {
options.mods.server.media = {
enable = lib.mkEnableOption {
default = false;
description = "enables media related servers";
{ pkgs, lib, config, ... }:
let
cfg = config.mods.server;
port = 2283;
in with lib; {
options.mods.server = {
videos = {
enable = mkEnableOption {
default = false;
description = "enables jellyfin server";
};
};
photos = {
enable = mkEnableOption {
default = false;
description = "enables immich server";
};
};
};
config = lib.mkIf config.mods.server.media.enable {
services.jellyfin = {
config = {
services.jellyfin = mkIf cfg.videos.enable {
enable = true;
openFirewall = true;
user = "${config.mods.user.name}";
};
services.immich = {
# mods.server.nginx.ports.photos = port;
services.nginx.virtualHosts."photos.muon.host" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://10.0.0.3:${toString port}";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig =
# required when the server wants to use HTTP Authentication
"proxy_pass_header Authorization;";
};
};
services.immich = mkIf cfg.photos.enable {
enable = true;
openFirewall = true;
host = "0.0.0.0";
# user = "${config.mods.user.name}";
port = port;
};
users.users.immich.extraGroups = [ "video" "render" ];
mods.server.nginx.hosts."photos" = 2283;
users.users.immich =
mkIf cfg.photos.enable { extraGroups = [ "video" "render" ]; };
};
}

View file

@ -20,7 +20,7 @@ in with lib; {
default = "muon.host";
};
hosts = mkOption {
ports = mkOption {
type = types.attrsOf (types.ints.u16);
default = { };
};
@ -71,21 +71,18 @@ in with lib; {
proxy_pass_header Authorization;
'';
virtualHosts = let
base = locations: {
inherit locations;
# virtualHosts = let
# base = locations: {
# inherit locations;
forceSSL = true;
enableACME = true;
};
proxy = port:
base {
"/".proxyPass = cfg.ip + toString port + "/";
default = true;
};
in mapAttrs'
(name: port: nameValuePair ("${name}.${cfg.domain}") (proxy port))
cfg.hosts;
# forceSSL = true;
# enableACME = true;
# };
# proxy = port:
# base { "/".proxyPass = "http://${cfg.ip}:${toString port}/"; };
# in mapAttrs' (name: port:
# nameValuePair ("${name}.${cfg.domain}")
# (proxy port // { default = true; })) cfg.ports;
};
};
}

View file

@ -2,36 +2,39 @@
let
inherit (lib) types mkOption mkEnableOption;
cfg = config.mods.server.search;
port = 8081;
in {
options.mods.server.search = {
enable = mkEnableOption {
default = false;
description = "enables search engine server";
};
port = mkOption {
type = types.port;
default = 8081;
};
nginx = mkOption {
type = types.nullOr types.str;
default = "search";
};
};
config = {
# mods.server.nginx.ports.search = port;
services.nginx.virtualHosts."search.muon.host" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://10.0.0.3:${toString port}";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig =
# required when the server wants to use HTTP Authentication
"proxy_pass_header Authorization;";
};
};
services.searx = lib.mkIf cfg.enable {
enable = true;
runInUwsgi = true;
uwsgiConfig = {
disable-logging = true;
http = ":${toString cfg.port}";
};
# runInUwsgi = true;
# uwsgiConfig = {
# disable-logging = true;
# http = ":${toString port}";
# };
settings = {
server.port = cfg.port;
server.port = port;
server.bind_address = "0.0.0.0";
server.secret_key = "temporary-before-sops";
@ -43,6 +46,5 @@ in {
};
};
};
};
}