fix(nix): rust overlay infinite recursion

The rust-overlay project strongly recommend NOT overlaying the global
Rust platform since that can cause a dependency loop, creating an
infinite recursion.

Instead, a custom `rustPlatform` can be passed to the derivation, as per
the instructions in the [Nixpkgs manual](https://nixos.org/manual/nixpkgs/stable/#using-rust-nightly-in-a-derivation-with-buildrustpackage).
This commit is contained in:
eljamm 2025-01-18 10:49:51 +01:00
parent ebaf2c29c1
commit 80ffb632df

View file

@ -21,21 +21,12 @@
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
(
final: prev:
let
toolchain = final.rust-bin.stable.latest.default;
in
{
rustPlatform = prev.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
}
)
];
overlays = [ rust-overlay.overlays.default ];
};
toolchain = pkgs.rust-bin.stable.latest.default;
rustPlatform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
rev = self.shortRev or self.dirtyShortRev or "dirty";
@ -46,7 +37,14 @@
in
{
packages = {
yazi-unwrapped = pkgs.callPackage ./nix/yazi-unwrapped.nix { inherit version rev date; };
yazi-unwrapped = pkgs.callPackage ./nix/yazi-unwrapped.nix {
inherit
version
rev
date
rustPlatform
;
};
yazi = pkgs.callPackage ./nix/yazi.nix { inherit (self.packages.${system}) yazi-unwrapped; };
default = self.packages.${system}.yazi;
};