Make Rust env more robust
This commit is contained in:
		
							parent
							
								
									f6d7e1f56a
								
							
						
					
					
						commit
						e566bd0822
					
				
					 2 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,2 +0,0 @@
 | 
			
		|||
[toolchain]
 | 
			
		||||
channel = "1.62.0"
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue