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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1665607107, "lastModified": 1665685160,
"narHash": "sha256-ALYav/rDpqZKxP4szZw6qgCd6sol1zZKHtVwylrKxTQ=", "narHash": "sha256-MkNROnBdE9ocwuVrK5J/AF7zGUv6g4UhfdZ6GTrNEJA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c119e44bcce824647eff0229449374b1f0c9ad0e", "rev": "849a740bc1342a18ce69bb08f82227202d1f7109",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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