From e0c0ae3ee7d1908785e3ab773e6c065ff39d358c Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Sun, 22 Jun 2025 14:21:39 +0100 Subject: [PATCH] hosts/library: add jellysearch --- flake.lock | 8 ++++---- hosts/library/default.nix | 1 + hosts/library/jellysearch.nix | 34 ++++++++++++++++++++++++++++++++++ hosts/library/nginx.nix | 12 ++++++++++-- 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 hosts/library/jellysearch.nix diff --git a/flake.lock b/flake.lock index 74ae3c1..0e22554 100644 --- a/flake.lock +++ b/flake.lock @@ -1000,11 +1000,11 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1748905535, - "narHash": "sha256-lRWIpo//dTT7kqtiuaeAITbL535eHImpcpcIfAg2wxs=", + "lastModified": 1750597864, + "narHash": "sha256-0RJ4opKFAFftQo+E68ZuDZK66UxFlRYVYlYyYCa3u+M=", "ref": "refs/heads/master", - "rev": "c6f23eddf543b4de1c8c596e51be1d5ba1137673", - "revCount": 32, + "rev": "b6a77c1782d3e5a65849e2ccf844384155f006be", + "revCount": 33, "type": "git", "url": "ssh://git@git.vimium.com/jordan/nix-secrets.git" }, diff --git a/hosts/library/default.nix b/hosts/library/default.nix index 1c85da7..a553891 100644 --- a/hosts/library/default.nix +++ b/hosts/library/default.nix @@ -8,6 +8,7 @@ ./ai.nix ./grafana.nix ./jellyfin.nix + ./jellysearch.nix ./nginx.nix ./prometheus.nix ./tunnel.nix diff --git a/hosts/library/jellysearch.nix b/hosts/library/jellysearch.nix new file mode 100644 index 0000000..079d533 --- /dev/null +++ b/hosts/library/jellysearch.nix @@ -0,0 +1,34 @@ +{ + inputs, + config, + ... +}: + +{ + age.secrets."files/services/meilisearch/envfile" = { + file = "${inputs.secrets}/files/services/meilisearch/envfile.age"; + }; + + services.meilisearch = { + enable = true; + masterKeyEnvironmentFile = config.age.secrets."files/services/meilisearch/envfile".path; + }; + + virtualisation.oci-containers.containers = { + jellysearch = { + image = "domistyle/jellysearch"; + environment = { + INDEX_CRON = "0 0 0/2 ? * * *"; + JELLYFIN_URL = "http://localhost:8096"; + MEILI_URL = "http://localhost:${toString config.services.meilisearch.listenPort}"; + }; + environmentFiles = [ + config.age.secrets."files/services/meilisearch/envfile".path + ]; + volumes = [ + "${toString config.services.jellyfin.configDir}:/config:ro" + ]; + extraOptions = [ "--network=host" ]; + }; + }; +} diff --git a/hosts/library/nginx.nix b/hosts/library/nginx.nix index d706539..db70511 100644 --- a/hosts/library/nginx.nix +++ b/hosts/library/nginx.nix @@ -63,9 +63,17 @@ } ]; locations."/" = { - proxyPass = "http://localhost:8096"; extraConfig = - proxyConfig + '' + # Proxy JellySearch first + if ($arg_searchTerm) { + proxy_pass http://localhost:5000; + break; + } + + proxy_pass http://localhost:8096; + '' + + proxyConfig + '' proxy_set_header Range $http_range; proxy_set_header If-Range $http_if_range;