1
1
Fork 0
mirror of https://github.com/the-nix-way/dev-templates synced 2024-05-07 22:16:08 +02:00

Add rust-toolchain template

This commit is contained in:
Luc Perkins 2022-10-20 16:14:56 +02:00
parent c4a5d837e4
commit 20b5b176c1
No known key found for this signature in database
GPG Key ID: 4F102D0C16E232F2
28 changed files with 221 additions and 73 deletions

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -9,7 +9,7 @@
outputs = { self, flake-utils, nixpkgs }:
{
templates = {
templates = rec {
cue = {
path = ./cue;
description = "Cue development environment";
@ -105,6 +105,11 @@
description = "Rust development environment";
};
rust-toolchain = {
path = ./rust-toolchain;
description = "Rust development environment with Rust version defined by a rust-toolchain.toml file";
};
scala = {
path = ./scala;
description = "Scala development environment";
@ -114,6 +119,9 @@
path = ./zig;
description = "Zig development environment";
};
# Aliases
rt = rust-toolchain;
};
} // flake-utils.lib.eachDefaultSystem (system:
let

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1661178095,
"narHash": "sha256-VP8KoVbqHT7dihr8XES0fM1SmuOxQGyRP85MMDTSEf0=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d2a38cb03b8f5badfb70bfc2acb3151ed9609e38",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -67,11 +67,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

1
rust-toolchain/.envrc Normal file
View File

@ -0,0 +1 @@
use flake .

93
rust-toolchain/flake.lock Normal file
View 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
View 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
'';
};
});
}

View File

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

View File

@ -32,11 +32,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {
@ -74,11 +74,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1665543630,
"narHash": "sha256-tt3EmBcNCER8G9mCmYmPel/KwMlkIP56un33ArE65eo=",
"lastModified": 1665630024,
"narHash": "sha256-xXfneoHz4h4JR58leKFoHIIapAffWlOL9HI37vwuspo=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "8c727f07aa0ce5b618a3c653da75ace830485b21",
"rev": "73650741960a7422d1422f156f76211e576610c2",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1665607107,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=",
"lastModified": 1665685160,
"narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e",
"rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github"
},
"original": {