I saw a
preferLocalBuild attribute in the minecraft-server derivation. What does it do, and when should someone use it?
I couldn’t find documentation for what it does, so I thought I’d ask here for the sake of future search engine users and myself.
only matters if you have remote builders.
If this attribute is set to true and distributed building is enabled, then, if possible, the derivaton will be built locally instead of forwarded to a remote machine. This is appropriate for trivial builders where the cost of doing a download or remote build would exceed the cost of building locally.
The reason why the minecraft-server does this is that the “build” process is essentially pulling down a large .jar file. There’s really no expensive build process involved with creating the build artifacts.
There’s no impact on whether the result is fetched from binary cache or not?
Correct, this is only concerned with the “build”. If a cache hit is available, nix will generally prefer the pre-built package.
IIRC the attribute for that is
IIRC, allowSubstitutes will allow for a remote machine to download build dependencies. Generally this is the desired case if the remote machine has a faster connection, such as being located in a datacenter
allowSubstitutes strange as it’s not always a property of the package but a combination of the local host and proximity to caching infrastructure. For example, I always want to be able to substitute builds from our on-premises cache. But that’s not possible if
I proposed to add an option to allow override via configuration, but no feedback as of yet: Allow overriding `allowSubstitutes` without modification to derivation · Issue #3686 · NixOS/nix · GitHub. I don’t know if there are other reasonable options.