Pin the rust version in `flake.nix`, and bump to 1.70.0 to fix installing `ruff` (#15940)

pull/15955/head
Andrew Morgan 2023-07-17 09:36:12 +01:00 committed by GitHub
parent cba2df20b5
commit 85e0541db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 43 deletions

1
changelog.d/15940.misc Normal file
View File

@ -0,0 +1 @@
Unbreak the nix development environment by pinning the Rust version to 1.70.0.

View File

@ -22,27 +22,6 @@
"type": "github" "type": "github"
} }
}, },
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1682490133,
"narHash": "sha256-tR2Qx0uuk97WySpSSk4rGS/oH7xb5LykbjATcw1vw1I=",
"owner": "nix-community",
"repo": "fenix",
"rev": "4e9412753ab75ef0e038a5fe54a062fb44c27c6a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -74,6 +53,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -200,6 +197,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -231,25 +244,27 @@
"root": { "root": {
"inputs": { "inputs": {
"devenv": "devenv", "devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"systems": "systems" "rust-overlay": "rust-overlay",
"systems": "systems_2"
} }
}, },
"rust-analyzer-src": { "rust-overlay": {
"flake": false, "inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": { "locked": {
"lastModified": 1682426789, "lastModified": 1689302058,
"narHash": "sha256-UqnLmJESRZE0tTEaGbRAw05Hm19TWIPA+R3meqi5I4w=", "narHash": "sha256-yD74lcHTrw4niXcE9goJLbzsgyce48rQQoy5jK5ZK40=",
"owner": "rust-lang", "owner": "oxalica",
"repo": "rust-analyzer", "repo": "rust-overlay",
"rev": "943d2a8a1ca15e8b28a1f51f5a5c135e3728da04", "rev": "7b8dbbf4c67ed05a9bf3d9e658c12d4108bc24c8",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "rust-lang", "owner": "oxalica",
"ref": "nightly", "repo": "rust-overlay",
"repo": "rust-analyzer",
"type": "github" "type": "github"
} }
}, },
@ -267,6 +282,21 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@ -46,20 +46,20 @@
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
# A development environment manager built on Nix. See https://devenv.sh. # A development environment manager built on Nix. See https://devenv.sh.
devenv.url = "github:cachix/devenv/main"; devenv.url = "github:cachix/devenv/main";
# Rust toolchains and rust-analyzer nightly. # Rust toolchain.
fenix = { rust-overlay.url = "github:oxalica/rust-overlay";
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, nixpkgs, devenv, systems, ... } @ inputs: outputs = { self, nixpkgs, devenv, systems, rust-overlay, ... } @ inputs:
let let
forEachSystem = nixpkgs.lib.genAttrs (import systems); forEachSystem = nixpkgs.lib.genAttrs (import systems);
in { in {
devShells = forEachSystem (system: devShells = forEachSystem (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in { in {
# Everything is configured via devenv - a Nix module for creating declarative # Everything is configured via devenv - a Nix module for creating declarative
# developer environments. See https://devenv.sh/reference/options/ for a list # developer environments. See https://devenv.sh/reference/options/ for a list
@ -76,6 +76,20 @@
# Configure packages to install. # Configure packages to install.
# Search for package names at https://search.nixos.org/packages?channel=unstable # Search for package names at https://search.nixos.org/packages?channel=unstable
packages = with pkgs; [ packages = with pkgs; [
# The rust toolchain and related tools.
# This will install the "default" profile of rust components.
# https://rust-lang.github.io/rustup/concepts/profiles.html
#
# NOTE: We currently need to set the Rust version unnecessarily high
# in order to work around https://github.com/matrix-org/synapse/issues/15939
(rust-bin.stable."1.70.0".default.override {
# Additionally install the "rust-src" extension to allow diving into the
# Rust source code in an IDE (rust-analyzer will also make use of it).
extensions = [ "rust-src" ];
})
# The rust-analyzer language server implementation.
rust-analyzer
# Native dependencies for running Synapse. # Native dependencies for running Synapse.
icu icu
libffi libffi
@ -124,12 +138,11 @@
# Install dependencies for the additional programming languages # Install dependencies for the additional programming languages
# involved with Synapse development. # involved with Synapse development.
# #
# * Rust is used for developing and running Synapse.
# * Golang is needed to run the Complement test suite. # * Golang is needed to run the Complement test suite.
# * Perl is needed to run the SyTest test suite. # * Perl is needed to run the SyTest test suite.
# * Rust is used for developing and running Synapse.
# It is installed manually with `packages` above.
languages.go.enable = true; languages.go.enable = true;
languages.rust.enable = true;
languages.rust.version = "stable";
languages.perl.enable = true; languages.perl.enable = true;
# Postgres is needed to run Synapse with postgres support and # Postgres is needed to run Synapse with postgres support and