Make Rust env more robust
This commit is contained in:
parent
f6d7e1f56a
commit
e566bd0822
|
@ -13,10 +13,16 @@
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
|
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
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) mkShell;
|
||||||
inherit (pkgs.lib) optionals;
|
inherit (pkgs.lib) optionals;
|
||||||
|
@ -26,7 +32,9 @@
|
||||||
|
|
||||||
devShells = {
|
devShells = {
|
||||||
default = mkShell {
|
default = mkShell {
|
||||||
buildInputs = [ rust ] ++ helpers;
|
nativeBuildInputs = [ rust ];
|
||||||
|
|
||||||
|
buildInputs = helpers;
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${rust}/bin/cargo --version
|
${rust}/bin/cargo --version
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[toolchain]
|
|
||||||
channel = "1.62.0"
|
|
Loading…
Reference in a new issue