From 35da064ed5748393e7851759bad25c3c655a1dd5 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 20 Oct 2022 17:21:43 +0300 Subject: [PATCH] sonic-server: init at 1.4.0 --- maintainers/maintainer-list.nix | 34 +++++++------ pkgs/servers/search/sonic-server/default.nix | 53 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 pkgs/servers/search/sonic-server/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 426ffbe7666f..22cbb8f32188 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -326,10 +326,10 @@ name = "Maxwell Huang-Hobbs"; }; adjacentresearch = { - email = "nate@adjacentresearch.xyz"; - github = "0xperp"; - githubId = 96147421; - name = "0xperp"; + email = "nate@adjacentresearch.xyz"; + github = "0xperp"; + githubId = 96147421; + name = "0xperp"; }; adnelson = { email = "ithinkican@gmail.com"; @@ -528,10 +528,10 @@ name = "Aksh Gupta"; }; alapshin = { - email = "alapshin@fastmail.com"; - github = "alapshin"; - githubId = 321946; - name = "Andrei Lapshin"; + email = "alapshin@fastmail.com"; + github = "alapshin"; + githubId = 321946; + name = "Andrei Lapshin"; }; albakham = { email = "dev@geber.ga"; @@ -5754,7 +5754,7 @@ githubId = 40234257; name = "ilkecan bozdogan"; }; - not-my-segfault = { + not-my-segfault = { email = "michal@tar.black"; matrix = "@michal:tar.black"; github = "not-my-segfault"; @@ -10755,6 +10755,12 @@ githubId = 358550; name = "Philip Lykke Carlsen"; }; + pleshevskiy = { + email = "dmitriy@pleshevski.ru"; + github = "pleshevskiy"; + githubId = 7839004; + name = "Dmitriy Pleshevskiy"; + }; plumps = { email = "maks.bronsky@web.de"; github = "plumps"; @@ -14070,11 +14076,11 @@ name = "Urban Skudnik"; }; usrfriendly = { - name = "Arin Lares"; - email = "arinlares@gmail.com"; - github = "usrfriendly"; - githubId = 2502060; - }; + name = "Arin Lares"; + email = "arinlares@gmail.com"; + github = "usrfriendly"; + githubId = 2502060; + }; utdemir = { email = "me@utdemir.com"; github = "utdemir"; diff --git a/pkgs/servers/search/sonic-server/default.nix b/pkgs/servers/search/sonic-server/default.nix new file mode 100644 index 000000000000..4eb88b7f04fd --- /dev/null +++ b/pkgs/servers/search/sonic-server/default.nix @@ -0,0 +1,53 @@ +{ lib +, rustPlatform +, llvmPackages +, clang +, fetchFromGitHub +}: + +rustPlatform.buildRustPackage { + pname = "sonic-server"; + version = "1.4.0"; + + src = fetchFromGitHub { + owner = "valeriansaliou"; + repo = "sonic"; + rev = "f5302f5c424256648ba0be32b3c5909d846821fe"; + sha256 = "sha256-WebEluXijgJckZQOka2BDPYn7PqzPTsIcV2T380fxW8="; + }; + + cargoSha256 = "sha256-ObhKGjaIma6fUVUT3xadpy/GPYlnm0nKmRVxFmoePyQ="; + + doCheck = false; + + nativeBuildInputs = [ + llvmPackages.libclang + llvmPackages.libcxxClang + clang + ]; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion clang}/include"; + + postPatch = '' + substituteInPlace src/main.rs --replace "./config.cfg" "$out/etc/sonic/config.cfg" + ''; + + postInstall = '' + mkdir -p $out/etc/ + mkdir -p $out/usr/lib/systemd/system/ + + install -Dm444 -t $out/etc/sonic config.cfg + substitute \ + ./examples/config/systemd.service $out/usr/lib/systemd/system/sonic-server.service \ + --replace /bin/sonic $out/bin/sonic \ + --replace /etc/sonic.cfg $out/etc/sonic/config.cfg + ''; + + meta = with lib; { + description = "Fast, lightweight and schema-less search backend"; + homepage = "https://github.com/valeriansaliou/sonic"; + license = licenses.mpl20; + platforms = platforms.unix; + maintainers = with maintainers; [ pleshevskiy ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 791d48213915..6634fbe78f0d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7490,6 +7490,8 @@ with pkgs; openssl = openssl_1_1; }; + sonic-server = callPackage ../servers/search/sonic-server { }; + gsmartcontrol = callPackage ../tools/misc/gsmartcontrol { }; gsmlib = callPackage ../development/libraries/gsmlib