Make Rust env more robust

This commit is contained in:
Luc Perkins 2022-07-29 02:29:34 +02:00
parent f6d7e1f56a
commit e566bd0822
No known key found for this signature in database
GPG key ID: 4F102D0C16E232F2
2 changed files with 11 additions and 5 deletions

View file

@ -13,10 +13,16 @@
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
inherit (pkgs) rust-bin;
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rust = if builtins.pathExists ./rust-toolchain.toml then
rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust-bin.fromRustupToolchainFile ./rust-toolchain
else
rust-bin.stable.latest.default;
helpers = with pkgs; [ openssl pkg-config ];
helpers = with pkgs; [ openssl pkgconfig ];
inherit (pkgs) mkShell;
inherit (pkgs.lib) optionals;
@ -26,7 +32,9 @@
devShells = {
default = mkShell {
buildInputs = [ rust ] ++ helpers;
nativeBuildInputs = [ rust ];
buildInputs = helpers;
shellHook = ''
${rust}/bin/cargo --version

View file

@ -1,2 +0,0 @@
[toolchain]
channel = "1.62.0"