nixpkgs/pkgs/servers/search/meilisearch/default.nix
2021-09-14 18:23:03 +09:00

50 lines
1.1 KiB
Nix

{ pkgs
, lib
, stdenv
, buildRustCrate
, defaultCrateOverrides
, fetchFromGitHub
, Security
, features ? [ ]
}:
let
version = "0.21.1";
src = fetchFromGitHub {
owner = "meilisearch";
repo = "MeiliSearch";
rev = "v${version}";
sha256 = "sha256-wyyhTNhVw8EJhahstLK+QuEhufQC68rMpw/ngK8FL8Y=";
};
customBuildRustCrateForPkgs = pkgs: buildRustCrate.override {
defaultCrateOverrides = defaultCrateOverrides // {
meilisearch-http = attrs: {
src = "${src}/meilisearch-http";
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
};
meilisearch-error = attrs: {
src = "${src}/meilisearch-error";
};
};
};
cargo_nix = import ./Cargo.nix {
inherit pkgs;
buildRustCrateForPkgs = customBuildRustCrateForPkgs;
};
meilisearch-http = cargo_nix.workspaceMembers."meilisearch-http".build.override {
inherit features;
};
in
stdenv.mkDerivation {
pname = "meilisearch";
inherit version src;
dontUnpack = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
cp ${meilisearch-http}/bin/meilisearch $out/bin/meilisearch
'';
dontCheck = true;
dontFixup = true;
}