1{ stdenv
2, lib
3, patchelf
4, fetchFromGitHub
5, rustPlatform
6, makeBinaryWrapper
7, pkg-config
8, curl
9, Security
10, CoreServices
11, libiconv
12, xz
13, perl
14, substituteAll
15# for passthru.tests:
16, edgedb
17, testers
18}:
19
20rustPlatform.buildRustPackage rec {
21 pname = "edgedb";
22 version = "3.4.0";
23
24 src = fetchFromGitHub {
25 owner = "edgedb";
26 repo = "edgedb-cli";
27 rev = "v${version}";
28 sha256 = "sha256-w6YpjSmh517yat45l4gGdV6qWD4O3aCx/6LL5wea+RA=";
29 fetchSubmodules = true;
30 };
31
32 cargoLock = {
33 lockFile = ./Cargo.lock;
34 outputHashes = {
35 "edgedb-derive-0.5.0" = "sha256-y/mN0XuJtQBtkLmbk2s7hK5joGEH5Ge6sLCD88WyL9o=";
36 "edgeql-parser-0.1.0" = "sha256-Y3gXxPuR7qnTL4fu2nZIa3e20YV1fLvm2jHAng+Ke2Q=";
37 "indexmap-2.0.0-pre" = "sha256-QMOmoUHE1F/sp+NeDpgRGqqacWLHWG02YgZc5vAdXZY=";
38 "rexpect-0.5.0" = "sha256-vstAL/fJWWx7WbmRxNItKpzvgGF3SvJDs5isq9ym/OA=";
39 "rustyline-8.0.0" = "sha256-CrICwQbHPzS4QdVIEHxt2euX+g+0pFYe84NfMp1daEc=";
40 "serde_str-1.0.0" = "sha256-CMBh5lxdQb2085y0jc/DrV6B8iiXvVO2aoZH/lFFjak=";
41 };
42 };
43
44 nativeBuildInputs = [ makeBinaryWrapper pkg-config perl ];
45
46 buildInputs = [
47 curl
48 ] ++ lib.optionals stdenv.isDarwin [ CoreServices Security libiconv xz ];
49
50 checkFeatures = [ ];
51
52 patches = [
53 (substituteAll {
54 src = ./0001-dynamically-patchelf-binaries.patch;
55 inherit patchelf;
56 dynamicLinker = stdenv.cc.bintools.dynamicLinker;
57 })
58 ];
59
60 doCheck = false;
61
62 passthru.tests.version = testers.testVersion {
63 package = edgedb;
64 command = "edgedb --version";
65 };
66
67 meta = with lib; {
68 description = "EdgeDB cli";
69 homepage = "https://www.edgedb.com/docs/cli/index";
70 license = with licenses; [ asl20 /* or */ mit ];
71 maintainers = [ maintainers.ranfdev ];
72 };
73}