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 = "4.1.1";
23
24 src = fetchFromGitHub {
25 owner = "edgedb";
26 repo = "edgedb-cli";
27 rev = "v${version}";
28 hash = "sha256-PHtjm3xlGwkDskH3A9/QQrmzt2Xi+sqnQAQV6WG7a6M=";
29 fetchSubmodules = true;
30 };
31
32 cargoLock = {
33 lockFile = ./Cargo.lock;
34 outputHashes = {
35 "edgedb-derive-0.5.1" = "sha256-1tbWg3bLab3xlVQxb4G+kpXriO+zQpnrwAESy5Tqsu4=";
36 "edgeql-parser-0.1.0" = "sha256-c5xBuW47xXgy8VLR/P7DvVhLBd0rvI6P9w82IPPsTwo=";
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 = with maintainers; [ ahirner kirillrdy ];
72 mainProgram = "edgedb";
73 };
74}