Merge pull request #326532 from drupol/module/add-tika
nixos/tika: init module
This commit is contained in:
commit
1a8e33d451
@ -36,6 +36,8 @@
|
||||
|
||||
- [Glance](https://github.com/glanceapp/glance), a self-hosted dashboard that puts all your feeds in one place. Available as [services.glance](option.html#opt-services.glance).
|
||||
|
||||
- [Apache Tika](https://github.com/apache/tika), a toolkit that detects and extracts metadata and text from over a thousand different file types. Available as [services.tika](option.html#opt-services.tika).
|
||||
|
||||
## Backward Incompatibilities {#sec-release-24.11-incompatibilities}
|
||||
|
||||
- `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage:
|
||||
|
@ -1264,6 +1264,7 @@
|
||||
./services/search/qdrant.nix
|
||||
./services/search/quickwit.nix
|
||||
./services/search/sonic-server.nix
|
||||
./services/search/tika.nix
|
||||
./services/search/typesense.nix
|
||||
./services/security/aesmd.nix
|
||||
./services/security/authelia.nix
|
||||
|
84
nixos/modules/services/search/tika.nix
Normal file
84
nixos/modules/services/search/tika.nix
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.tika;
|
||||
inherit (lib)
|
||||
literalExpression
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkPackageOption
|
||||
getExe
|
||||
types
|
||||
;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.drupol ];
|
||||
|
||||
options = {
|
||||
services.tika = {
|
||||
enable = mkEnableOption "Apache Tika server";
|
||||
package = mkPackageOption pkgs "tika" { };
|
||||
|
||||
listenAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
example = "0.0.0.0";
|
||||
description = ''
|
||||
The Apache Tika bind address.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 9998;
|
||||
description = ''
|
||||
The Apache Tike port to listen on
|
||||
'';
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
The Apache Tika configuration (XML) file to use.
|
||||
'';
|
||||
example = literalExpression "./tika/tika-config.xml";
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to open the firewall for Apache Tika.
|
||||
This adds `services.tika.port` to `networking.firewall.allowedTCPPorts`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.tika = {
|
||||
description = "Apache Tika Server";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
|
||||
ExecStart = "${getExe cfg.package} --host ${cfg.listenAddress} --port ${toString cfg.port} ${lib.optionalString (cfg.configFile != null) "--config ${cfg.configFile}"}";
|
||||
DynamicUser = true;
|
||||
StateDirectory = "tika";
|
||||
CacheDirectory = "tika";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };
|
||||
};
|
||||
}
|
@ -980,6 +980,7 @@ in {
|
||||
thanos = handleTest ./thanos.nix {};
|
||||
tiddlywiki = handleTest ./tiddlywiki.nix {};
|
||||
tigervnc = handleTest ./tigervnc.nix {};
|
||||
tika = runTest ./tika.nix;
|
||||
timescaledb = handleTest ./timescaledb.nix {};
|
||||
timezone = handleTest ./timezone.nix {};
|
||||
tinc = handleTest ./tinc {};
|
||||
|
21
nixos/tests/tika.nix
Normal file
21
nixos/tests/tika.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "tika-server";
|
||||
|
||||
nodes = {
|
||||
machine = { pkgs, ... }: {
|
||||
services.tika = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.start()
|
||||
machine.wait_for_unit("tika.service")
|
||||
machine.wait_for_open_port(9998)
|
||||
'';
|
||||
|
||||
meta.maintainers = [ lib.maintainers.drupol ];
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
fetchFromGitHub,
|
||||
makeWrapper,
|
||||
mvnDepsHash ? null,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
let
|
||||
@ -45,7 +46,7 @@ maven'.buildMavenPackage rec {
|
||||
mvnHash = if mvnDepsHash != null then mvnDepsHash else knownMvnDepsHash;
|
||||
|
||||
mvnParameters = toString [
|
||||
"-DskipTests=true" # skip tests (out of memory execptions)
|
||||
"-DskipTests=true" # skip tests (out of memory exceptions)
|
||||
"-Dossindex.skip" # skip dependency with vulnerability (recommended by upstream)
|
||||
];
|
||||
|
||||
@ -67,6 +68,10 @@ maven'.buildMavenPackage rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) tika;
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/apache/tika/blob/${src.rev}/CHANGES.txt";
|
||||
description = "A toolkit for extracting metadata and text from over a thousand different file types";
|
||||
|
Loading…
Reference in New Issue
Block a user