nix: use rust-overlay for nightly Rust

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I74b2d21496261a3178ce043a5990583d6a6a6964
This commit is contained in:
raf 2026-02-07 23:01:42 +03:00
commit c310ca5635
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
9 changed files with 65 additions and 12 deletions

View file

@ -2,12 +2,17 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
crane,
self,
rust-overlay,
...
}: let
inherit (nixpkgs) lib;
@ -20,8 +25,16 @@
};
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
pkgs = nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default;
craneLib = (crane.mkLib pkgs).overrideToolchain (p:
# Build tools
# We use the rust-overlay to get the stable Rust toolchain for various targets.
# This is not exactly necessary, but it allows for compiling for various targets
# with the least amount of friction.
p.rust-bin.nightly.latest.default.override {
extensions = ["rustfmt" "rust-analyzer" "clippy"];
targets = [];
});
src = let
fs = lib.fileset;
@ -97,8 +110,6 @@
postgresql_18
taplo
(rustfmt.override {asNightly = true;})
clippy
cargo-nextest
];
};