2022-10-30 15:09:59 +00:00
|
|
|
{ lib
|
2024-01-02 11:29:13 +00:00
|
|
|
, stdenv
|
2022-10-30 15:09:59 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2024-01-02 11:29:13 +00:00
|
|
|
, fetchpatch
|
2023-10-19 13:55:26 +00:00
|
|
|
, nix-update-script
|
2024-01-02 11:29:13 +00:00
|
|
|
, nixosTests
|
2023-10-19 13:55:26 +00:00
|
|
|
, testers
|
|
|
|
, sonic-server
|
2022-10-30 15:09:59 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2022-10-30 15:09:59 +00:00
|
|
|
pname = "sonic-server";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "1.4.3";
|
2022-10-30 15:09:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "valeriansaliou";
|
|
|
|
repo = "sonic";
|
2023-10-19 13:55:26 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-V97K4KS46DXje4qKA11O9NEm0s13aTUnM+XW8lGc6fo=";
|
2022-10-30 15:09:59 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
cargoPatches = [
|
|
|
|
# Update rocksdb to 0.21 to fix compilation issues against clang 16, see:
|
|
|
|
# https://github.com/valeriansaliou/sonic/issues/315
|
|
|
|
# https://github.com/valeriansaliou/sonic/pull/316
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/valeriansaliou/sonic/commit/81d5f1efec21ef8b911ed3303fcbe9ca6335f562.patch";
|
|
|
|
hash = "sha256-nOvHThTc2L3UQRVusUsD/OzbSkhSleZc6n0WyZducHM=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
cargoHash = "sha256-k+gPCkf8DCnuv/aLXcQwjmsDUu/eqSEqKXlUyj8bRq8=";
|
2022-10-30 15:09:59 +00:00
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
# Found argument '--test-threads' which wasn't expected, or isn't valid in this context
|
2022-10-30 15:09:59 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
rustPlatform.bindgenHook
|
2022-10-30 15:09:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/main.rs --replace "./config.cfg" "$out/etc/sonic/config.cfg"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
install -Dm444 -t $out/etc/sonic config.cfg
|
2023-10-19 13:55:26 +00:00
|
|
|
install -Dm444 -t $out/lib/systemd/system debian/sonic.service
|
|
|
|
|
|
|
|
substituteInPlace \
|
|
|
|
$out/lib/systemd/system/sonic.service \
|
|
|
|
--replace /usr/bin/sonic $out/bin/sonic \
|
2022-10-30 15:09:59 +00:00
|
|
|
--replace /etc/sonic.cfg $out/etc/sonic/config.cfg
|
|
|
|
'';
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
2024-01-02 11:29:13 +00:00
|
|
|
inherit (nixosTests) sonic-server;
|
2023-10-19 13:55:26 +00:00
|
|
|
version = testers.testVersion {
|
|
|
|
command = "sonic --version";
|
|
|
|
package = sonic-server;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast, lightweight and schema-less search backend";
|
|
|
|
homepage = "https://github.com/valeriansaliou/sonic";
|
2023-10-19 13:55:26 +00:00
|
|
|
changelog = "https://github.com/valeriansaliou/sonic/releases/tag/v${version}";
|
2022-10-30 15:09:59 +00:00
|
|
|
license = licenses.mpl20;
|
|
|
|
platforms = platforms.unix;
|
2023-10-19 13:55:26 +00:00
|
|
|
mainProgram = "sonic";
|
|
|
|
maintainers = with maintainers; [ pleshevskiy anthonyroussel ];
|
2022-10-30 15:09:59 +00:00
|
|
|
};
|
|
|
|
}
|