1{ lib
2, callPackage
3, fetchFromGitHub
4, perl
5, rustPlatform
6, darwin
7, stdenv
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "rover";
12 version = "0.14.0";
13
14 src = fetchFromGitHub {
15 owner = "apollographql";
16 repo = pname;
17 rev = "v${version}";
18 sha256 = "sha256-fVgo5Ds/VK0kBpF+F2FdMvBnQj2IB+B5ToOK8ONdq6c=";
19 };
20
21 cargoSha256 = "sha256-fNqnpLNENLJEhbqxLFUqyjAf8tEPCLoGSRV91gOY9LI=";
22
23 buildInputs = lib.optionals stdenv.isDarwin [
24 darwin.apple_sdk.frameworks.Security
25 darwin.apple_sdk.frameworks.CoreServices
26 ];
27
28 nativeBuildInputs = [
29 perl
30 ];
31
32 # This test checks whether the plugins specified in the plugins json file are
33 # valid by making a network call to the repo that houses their binaries; but, the
34 # build env can't make network calls (impurity)
35 cargoTestFlags = [
36 "-- --skip=latest_plugins_are_valid_versions"
37 ];
38
39 # The rover-client's build script (xtask/src/commands/prep/schema.rs) will try to
40 # download the API's graphql schema at build time to our read-only filesystem.
41 # To avoid this we pre-download it to a location the build script checks.
42 preBuild = ''
43 cp ${./schema}/hash.id crates/rover-client/.schema/
44 cp ${./schema}/etag.id crates/rover-client/.schema/
45 cp ${./schema}/schema.graphql crates/rover-client/.schema/
46 '';
47
48 passthru.updateScript = ./update.sh;
49
50 # Some tests try to write configuration data to a location in the user's home
51 # directory. Since this would be /homeless-shelter during the build, point at
52 # a writeable location instead.
53 preCheck = ''
54 export APOLLO_CONFIG_HOME="$PWD"
55 '';
56
57 meta = with lib; {
58 description = "A CLI for interacting with ApolloGraphQL's developer tooling, including managing self-hosted and GraphOS graphs.";
59 homepage = "https://www.apollographql.com/docs/rover";
60 license = licenses.mit;
61 maintainers = [ maintainers.ivanbrennan maintainers.aaronarinder ];
62 };
63}