How do I pin the pkg version on Nix?

I want to edit Replit.nix and pin the pkg version.
I want to specify the version of Cargo.
current replit.nix:

{ pkgs }: {
    deps = [
      pkgs.rustup
      pkgs.rustc
      pkgs.rustfmt
      pkgs.cargo
      pkgs.cargo-edit
      pkgs.rust-analyzer
    ];
}

Please help me.

pkgs.cargo-X_X_X is the format I think, here is a related nix forum post

You need to make sure that the version is available on Nix first though, just use the search feature on Nix.

1 Like