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