Can't wrap my head around derivation dependencies

Hey,

First of all, thanks a lot for your help and your explanation.

So, if you are ok with that, I would like to separate your answer in multiple sections, and then we can discuss them. Also, I would like to rewrite it using my words (yeah, I’m that kind of guy, and also not a native english speaker.).

Cross compilation glossary

So:

  • build : where we build the derivation / package
  • host: where we’ll install the derivation / package
  • target : a server where we will run the derivation / package from the build to build the derivation / package for the host

As mentioned, target is a very specific case and in most cases, target == build. However, I think it’s important to define it because the word target is used 35 times in section 3.3 of the nixpkg documentation.

So the target is a potential third server used for Canadian Cross compilation. build generates a package that is not the final package, but a package that is able to build the final package, the one that can be run by host.

In more details:

  • build build the cross-compilation package for target
  • target get the cross-compilation package and run it. This will generate the final package.
  • host get the final package and run it.

As mentioned by @lheckemann, it’s kind of rare to see this case, but I wanted to try to explain it.

So the different use cases, by order of complexity:

build == target == host

The most common case : a server that is building for itself. So you create the derivation, build it, then host it. The target step here doesn’t exist.

build == target, separate host

A server build the final package, and host gets it and uses it. For example, a dedicated server used only for building package for other hosts. If I’m not mistaken, this is the case of the Nixos package cache: if available, our servers downloads packages from the cache, and those packages have been produced by another server.
Also, the target step doesn’t exist.

separate build, target and host

Canadian Cross, as described above. Rare case.

I’ll write a second post regarding the actual dependencies, and how they are used, but could you guys review what I have written above and correct it if needed ?

Thanks !