Hello fellow NixOS enjoyers,
This is my first post here, but I do often read a lot from you.
I did recently go through the fantastic experience of building packages with nix, and on top of that I decided to learn how to setup a devshell in the most “correct” way.
I am building a Rust package for different platforms, like windows and linux-musl (static). Using rustPlatform.buildRustPackage, from pkgs.pkgsStatic and pkgs.pkgsCross.mingwW64 it works flawlessly, but, as usual, when I solve one problem, two more appear.
I saw that when creating a package with packages.”TARGET”.something, I can nix develop .#something, but I don’t understand how is that shell created (and often doesn’t fully work for what I have to do), so I am trying to setup my own shell, just for understanding how things work.
My first question is, what is the difference between pkgs.pkgsStatic and pkgs.pkgsCross.musl64? Why is the non-static musl considered a “pkgsCross” and the static is not?
Second: When setting up a shell with mkShell, I have plenty of options:
I want to have the exact toolchain that it is used, or at least something that is very close, like if I build with pkgsStatic, then I want pkgsStatic.rustc, not pkgs.rustc. I could setup a shell using pkgs.mkShell and then supply pkgsStatic.rustc as nativeBuildInputs and also the opposite, but where is the difference?
Also what is the difference between pkgsStatic.buildPackages.rustc and pkgsStatic.rustc?
Thank you