switch to fenix to manage rust toolchain in nix

This commit is contained in:
Winter Hille 2025-11-10 21:05:01 -08:00
parent 728847157b
commit f1cc0e65d4
2 changed files with 59 additions and 2 deletions

39
flake.lock generated
View file

@ -1,5 +1,26 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1761806629,
"narHash": "sha256-3u8345VliQtbpOtCNYYpDTCsjS8A9osrpU03E8TaIBw=",
"owner": "nix-community",
"repo": "fenix",
"rev": "c7c690951af16e60912678fab6155fb120cc27b0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1758690382,
@ -18,8 +39,26 @@
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1761739801,
"narHash": "sha256-ONUpb+l5oEIb9iOGkmUhze5YjRexZ6sc3mwQyLXlcms=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "769ebafdc66559d620bdc414743f32bb28180c58",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",

View file

@ -1,12 +1,30 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self, nixpkgs }:
{
self,
nixpkgs,
fenix,
}:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
rustPkgs = fenix.packages.x86_64-linux.default;
rustPlatform = pkgs.makeRustPlatform {
inherit (rustPkgs)
cargo
rustc
;
};
nativeBuildInputs = with pkgs; [
pkg-config
m4
@ -29,7 +47,7 @@
};
devShells.x86_64-linux.default = mkShell {
packages = [
packages = with rustPkgs; [
cargo
clippy
rustc