mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 21:46:01 +01:00
using the build hook mechanism, by setting the derivation attribute
"preferLocalBuild" to true. This has a few use cases:
- The user environment builder. Since it just creates a bunch of
symlinks without much computation, there is no reason to do it
remotely. In fact, doing it remotely requires the entire closure
of the user environment to be copied to the remote machine, which
is extremely wasteful.
- `fetchurl'. Performing the download on a remote machine and then
copying it to the local machine involves twice as much network
traffic as performing the download locally, and doesn't save any
CPU cycles on the local machine.
18 lines
571 B
Nix
18 lines
571 B
Nix
{system, derivations, manifest}:
|
|
|
|
derivation {
|
|
name = "user-environment";
|
|
system = system;
|
|
builder = ./builder.pl;
|
|
|
|
manifest = manifest;
|
|
|
|
# !!! grmbl, need structured data for passing this in a clean way.
|
|
paths = derivations;
|
|
active = map (x: if x ? meta && x.meta ? active then x.meta.active else "true") derivations;
|
|
priority = map (x: if x ? meta && x.meta ? priority then x.meta.priority else "5") derivations;
|
|
|
|
# Building user environments remotely just causes huge amounts of
|
|
# network traffic, so don't do that.
|
|
preferLocalBuild = true;
|
|
}
|