Add rust-toolchain template
This commit is contained in:
		
							parent
							
								
									c4a5d837e4
								
							
						
					
					
						commit
						20b5b176c1
					
				
					 28 changed files with 221 additions and 73 deletions
				
			
		
							
								
								
									
										1
									
								
								rust-toolchain/.envrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								rust-toolchain/.envrc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
use flake .
 | 
			
		||||
							
								
								
									
										93
									
								
								rust-toolchain/flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								rust-toolchain/flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,93 @@
 | 
			
		|||
{
 | 
			
		||||
  "nodes": {
 | 
			
		||||
    "flake-utils": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1659877975,
 | 
			
		||||
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "flake-utils_2": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1659877975,
 | 
			
		||||
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1665685160,
 | 
			
		||||
        "narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs_2": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1665296151,
 | 
			
		||||
        "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "NixOS",
 | 
			
		||||
        "ref": "nixpkgs-unstable",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "root": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": "flake-utils",
 | 
			
		||||
        "nixpkgs": "nixpkgs",
 | 
			
		||||
        "rust-overlay": "rust-overlay"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "rust-overlay": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": "flake-utils_2",
 | 
			
		||||
        "nixpkgs": "nixpkgs_2"
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1665630024,
 | 
			
		||||
        "narHash": "sha256-xXfneoHz4h4JR58leKFoHIIapAffWlOL9HI37vwuspo=",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "rev": "73650741960a7422d1422f156f76211e576610c2",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "root": "root",
 | 
			
		||||
  "version": 7
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								rust-toolchain/flake.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								rust-toolchain/flake.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
{
 | 
			
		||||
  description = "A Nix-flake-based Rust development environment";
 | 
			
		||||
 | 
			
		||||
  inputs = {
 | 
			
		||||
    flake-utils.url = "github:numtide/flake-utils";
 | 
			
		||||
    nixpkgs.url = "github:NixOS/nixpkgs";
 | 
			
		||||
    rust-overlay.url = "github:oxalica/rust-overlay";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs =
 | 
			
		||||
    { self
 | 
			
		||||
    , flake-utils
 | 
			
		||||
    , nixpkgs
 | 
			
		||||
    , rust-overlay
 | 
			
		||||
    }:
 | 
			
		||||
 | 
			
		||||
    flake-utils.lib.eachDefaultSystem (system:
 | 
			
		||||
    let
 | 
			
		||||
      overlays = [
 | 
			
		||||
        (import rust-overlay)
 | 
			
		||||
        (self: super: {
 | 
			
		||||
          rustToolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
 | 
			
		||||
        })
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      pkgs = import nixpkgs { inherit system overlays; };
 | 
			
		||||
    in
 | 
			
		||||
    {
 | 
			
		||||
      devShells.default = pkgs.mkShell {
 | 
			
		||||
        nativeBuildInputs = with pkgs; [
 | 
			
		||||
          rustToolchain
 | 
			
		||||
          openssl
 | 
			
		||||
          pkg-config
 | 
			
		||||
          cargo-deny
 | 
			
		||||
          cargo-edit
 | 
			
		||||
          rust-analyzer
 | 
			
		||||
        ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ cargo-watch ]); # Currently broken on macOS
 | 
			
		||||
 | 
			
		||||
        shellHook = ''
 | 
			
		||||
          ${pkgs.rustToolchain}/bin/cargo --version
 | 
			
		||||
        '';
 | 
			
		||||
      };
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								rust-toolchain/rust-toolchain.toml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								rust-toolchain/rust-toolchain.toml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
[toolchain]
 | 
			
		||||
channel = "1.64.0"
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue