这是indexloc提供的服务,不要输入任何密码
Skip to content

update rust to 1.80.0 #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Developing

## Project Maintenance Notes

### Updating GraphQL Engine for integration tests

It's important to keep the GraphQL Engine version updated to make sure that the
connector is working with the latest engine version. To update run,

```sh
$ nix flake lock --update-input graphql-engine-source
```

Then commit the changes to `flake.lock` to version control.

A specific engine version can be specified by editing `flake.lock` instead of
running the above command like this:

```diff
graphql-engine-source = {
- url = "github:hasura/graphql-engine";
+ url = "github:hasura/graphql-engine/<git-hash-branch-or-tag>";
flake = false;
};
```

### Updating Rust version

Updating the Rust version used in the Nix build system requires two steps (in
any order):

- update `rust-overlay` which provides Rust toolchains
- edit `rust-toolchain.toml` to specify the desired toolchain version

To update `rust-overlay` run,

```sh
$ nix flake lock --update-input rust-overlay
```

If you are using direnv to automatically apply the nix dev environment note that
edits to `rust-toolchain.toml` will not automatically update your environment.
You can make a temporary edit to `flake.nix` (like adding a space somewhere)
which will trigger an update, and then you can revert the change.

### Updating other project dependencies

You can update all dependencies declared in `flake.nix` at once by running,

```sh
$ nix flake update
```

This will update `graphql-engine-source` and `rust-overlay` as described above,
and will also update `advisory-db` to get updated security notices for cargo
dependencies, `nixpkgs` to get updates to openssl.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum ErrorResponseType {
MutationPermissionCheckFailure,
}

impl std::fmt::Display for ErrorResponseType {
impl Display for ErrorResponseType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::UncaughtError => f.write_str("uncaught-error"),
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
inputs = {
# nixpkgs provides packages such as mongosh and just, and provides libraries
# used to build the connector like openssl
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";

# Nix build system for Rust projects, delegates to cargo
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};

# Allows selecting arbitrary Rust toolchain configurations by editing
# `rust-toolchain.toml`
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};

# Security audit data for Rust projects
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
Expand Down Expand Up @@ -63,7 +69,7 @@
# packages or replace packages in that set.
overlays = [
(import rust-overlay)
(final: prev: rec {
(final: prev: {
# What's the deal with `pkgsBuildHost`? It has to do with
# cross-compiling.
#
Expand All @@ -75,7 +81,7 @@
# `pkgsBuildHost` contains copies of all packages compiled to run on
# the build system, and to produce outputs for the host system.
rustToolchain = final.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib final).overrideToolchain rustToolchain;
craneLib = (crane.mkLib final).overrideToolchain (pkgs: pkgs.rustToolchain);

# Extend our package set with mongodb-connector, graphql-engine, and
# other packages built by this flake to make these packages accessible
Expand Down
2 changes: 1 addition & 1 deletion nix/cargo-boilerplate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let
# building for in case we are cross-compiling. In practice this is only
# necessary if we are statically linking, and therefore have a `musl` target.
# But it doesn't hurt anything to make this override in other cases.
toolchain = rustToolchain.override { targets = [ buildTarget ]; };
toolchain = pkgs: pkgs.rustToolchain.override { targets = [ buildTarget ]; };

# Converts host system string for use in environment variable names
envCase = triple: lib.strings.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] triple);
Expand Down
4 changes: 3 additions & 1 deletion nix/graphql-engine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
# The following arguments come from nixpkgs, and are automatically populated
# by `callPackage`.
, callPackage
, craneLib
, git
, openssl
, pkg-config
, protobuf
, rust-bin
}:

let
boilerplate = callPackage ./cargo-boilerplate.nix { };
recursiveMerge = callPackage ./recursiveMerge.nix { };

craneLib = boilerplate.craneLib.overrideToolchain (pkgs: rust-bin.fromRustupToolchainFile "${src}/rust-toolchain.toml");

buildArgs = recursiveMerge [
boilerplate.buildArgs
{
Expand Down
3 changes: 2 additions & 1 deletion nix/v3-e2e-testing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# The following arguments come from nixpkgs, and are automatically populated
# by `callPackage`.
, callPackage
, craneLib
, jq
, makeWrapper
, openssl
Expand All @@ -28,6 +27,8 @@ let
boilerplate = callPackage ./cargo-boilerplate.nix { };
recursiveMerge = callPackage ./recursiveMerge.nix { };

inherit (boilerplate) craneLib;

buildArgs = recursiveMerge [
boilerplate.buildArgs
{
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.77.1"
channel = "1.80.0"
profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html
components = [] # see https://rust-lang.github.io/rustup/concepts/components.html
Loading