|
46 | 46 | systems.url = "github:nix-systems/default"; |
47 | 47 | # A development environment manager built on Nix. See https://devenv.sh. |
48 | 48 | devenv.url = "github:cachix/devenv/main"; |
49 | | - # Rust toolchains and rust-analyzer nightly. |
50 | | - fenix = { |
51 | | - url = "github:nix-community/fenix"; |
52 | | - inputs.nixpkgs.follows = "nixpkgs"; |
53 | | - }; |
| 49 | + # Rust toolchain. |
| 50 | + rust-overlay.url = "github:oxalica/rust-overlay"; |
54 | 51 | }; |
55 | 52 |
|
56 | | - outputs = { self, nixpkgs, devenv, systems, ... } @ inputs: |
| 53 | + outputs = { self, nixpkgs, devenv, systems, rust-overlay, ... } @ inputs: |
57 | 54 | let |
58 | 55 | forEachSystem = nixpkgs.lib.genAttrs (import systems); |
59 | 56 | in { |
60 | 57 | devShells = forEachSystem (system: |
61 | 58 | let |
62 | | - pkgs = nixpkgs.legacyPackages.${system}; |
| 59 | + overlays = [ (import rust-overlay) ]; |
| 60 | + pkgs = import nixpkgs { |
| 61 | + inherit system overlays; |
| 62 | + }; |
63 | 63 | in { |
64 | 64 | # Everything is configured via devenv - a Nix module for creating declarative |
65 | 65 | # developer environments. See https://devenv.sh/reference/options/ for a list |
|
76 | 76 | # Configure packages to install. |
77 | 77 | # Search for package names at https://search.nixos.org/packages?channel=unstable |
78 | 78 | packages = with pkgs; [ |
| 79 | + # The rust toolchain and related tools. |
| 80 | + # This will install the "default" profile of rust components. |
| 81 | + # https://rust-lang.github.io/rustup/concepts/profiles.html |
| 82 | + # |
| 83 | + # NOTE: We currently need to set the Rust version unnecessarily high |
| 84 | + # in order to work around https://github.com/matrix-org/synapse/issues/15939 |
| 85 | + (rust-bin.stable."1.70.0".default.override { |
| 86 | + # Additionally install the "rust-src" extension to allow diving into the |
| 87 | + # Rust source code in an IDE (rust-analyzer will also make use of it). |
| 88 | + extensions = [ "rust-src" ]; |
| 89 | + }) |
| 90 | + # The rust-analyzer language server implementation. |
| 91 | + rust-analyzer |
| 92 | + |
79 | 93 | # Native dependencies for running Synapse. |
80 | 94 | icu |
81 | 95 | libffi |
|
124 | 138 | # Install dependencies for the additional programming languages |
125 | 139 | # involved with Synapse development. |
126 | 140 | # |
127 | | - # * Rust is used for developing and running Synapse. |
128 | 141 | # * Golang is needed to run the Complement test suite. |
129 | 142 | # * Perl is needed to run the SyTest test suite. |
| 143 | + # * Rust is used for developing and running Synapse. |
| 144 | + # It is installed manually with `packages` above. |
130 | 145 | languages.go.enable = true; |
131 | | - languages.rust.enable = true; |
132 | | - languages.rust.version = "stable"; |
133 | 146 | languages.perl.enable = true; |
134 | 147 |
|
135 | 148 | # Postgres is needed to run Synapse with postgres support and |
|
0 commit comments