From acee315be027c8fd3addc37626b56ed241ff5c2d Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Sat, 2 Dec 2023 03:48:16 +0100 Subject: [PATCH] link to the configuration docs for distributed builds --- doc/manual/redirects.js | 2 +- doc/manual/src/contributing/hacking.md | 4 ++-- doc/manual/src/glossary.md | 2 +- .../src/language/advanced-attributes.md | 2 +- doc/manual/src/language/derivations.md | 2 +- src/libstore/build/derivation-goal.cc | 9 +++++--- src/libstore/build/worker.cc | 22 ++++++++++++++----- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/doc/manual/redirects.js b/doc/manual/redirects.js index 3b507adf3418..89a69dde4368 100644 --- a/doc/manual/redirects.js +++ b/doc/manual/redirects.js @@ -18,7 +18,7 @@ const redirects = { "chap-tuning-cores-and-jobs": "advanced-topics/cores-vs-jobs.html", "chap-diff-hook": "advanced-topics/diff-hook.html", "check-dirs-are-unregistered": "advanced-topics/diff-hook.html#check-dirs-are-unregistered", - "chap-distributed-builds": "advanced-topics/distributed-builds.html", + "chap-distributed-builds": "command-ref/conf-file.html#conf-builders", "chap-post-build-hook": "advanced-topics/post-build-hook.html", "chap-post-build-hook-caveats": "advanced-topics/post-build-hook.html#implementation-caveats", "part-command-ref": "command-ref/command-ref.html", diff --git a/doc/manual/src/contributing/hacking.md b/doc/manual/src/contributing/hacking.md index 9de5ad39b586..93a3eba6a05b 100644 --- a/doc/manual/src/contributing/hacking.md +++ b/doc/manual/src/contributing/hacking.md @@ -124,10 +124,10 @@ Nix can be built for various platforms, as specified in [`flake.nix`]: In order to build Nix for a different platform than the one you're currently on, you need a way for your current Nix installation to build code for that -platform. Common solutions include [remote builders] and [binary format emulation] +platform. Common solutions include [remote build machines] and [binary format emulation] (only supported on NixOS). -[remote builders]: ../advanced-topics/distributed-builds.md +[remote builders]: @docroot@/language/derivations.md#attr-builder [binary format emulation]: https://nixos.org/manual/nixos/stable/options.html#opt-boot.binfmt.emulatedSystems Given such a setup, executing the build only requires selecting the respective attribute. diff --git a/doc/manual/src/glossary.md b/doc/manual/src/glossary.md index 07891175a4e4..308151aad0b9 100644 --- a/doc/manual/src/glossary.md +++ b/doc/manual/src/glossary.md @@ -36,7 +36,7 @@ This can be achieved by: - Fetching a pre-built [store object] from a [substituter] - Running the [`builder`](@docroot@/language/derivations.md#attr-builder) executable as specified in the corresponding [derivation] - - Delegating to a [remote builder](@docroot@/advanced-topics/distributed-builds.html) and retrieving the outputs + - Delegating to a [remote machine](@docroot@/command-ref/conf-file.md#conf-builders) and retrieving the outputs See [`nix-store --realise`](@docroot@/command-ref/nix-store/realise.md) for a detailed description of the algorithm. diff --git a/doc/manual/src/language/advanced-attributes.md b/doc/manual/src/language/advanced-attributes.md index 282b75af2cff..302674c83079 100644 --- a/doc/manual/src/language/advanced-attributes.md +++ b/doc/manual/src/language/advanced-attributes.md @@ -258,7 +258,7 @@ Derivations can declare some infrequently used optional attributes. - [`preferLocalBuild`]{#adv-attr-preferLocalBuild}\ If this attribute is set to `true` and [distributed building is - enabled](../advanced-topics/distributed-builds.md), then, if + set up](@docroot@/language/derivations.md#attr-builder), then, if possible, the derivation 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 diff --git a/doc/manual/src/language/derivations.md b/doc/manual/src/language/derivations.md index 2aded5527b9c..7cc84d164f40 100644 --- a/doc/manual/src/language/derivations.md +++ b/doc/manual/src/language/derivations.md @@ -36,7 +36,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect The system type on which the [`builder`](#attr-builder) executable is meant to be run. A necessary condition for Nix to build derivations locally is that the `system` attribute matches the current [`system` configuration option]. - It can automatically [build on other platforms](../advanced-topics/distributed-builds.md) by forwarding build requests to other machines. + It can automatically [build on other platforms](@docroot@/language/derivations.md#attr-builder) by forwarding build requests to other machines. [`system` configuration option]: @docroot@/command-ref/conf-file.md#conf-system diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 81eef7c4748b..7b771a5fe262 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -761,9 +761,12 @@ void DerivationGoal::tryToBuild() void DerivationGoal::tryLocalBuild() { throw Error( - "unable to build with a primary store that isn't a local store; " - "either pass a different '--store' or enable remote builds." - "\nhttps://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html"); + R"( + unable to build with a primary store that isn't a local store; + either pass a different '--store' or enable remote builds. + + for more information check 'man nix.conf' and search for '/machines' + )" } diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 01f52e7aba7a..f461e834ba0c 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -331,13 +331,23 @@ void Worker::run(const Goals & _topGoals) if (awake.empty() && 0U == settings.maxBuildJobs) { if (getMachines().empty()) - throw Error("unable to start any build; either increase '--max-jobs' " - "or enable remote builds." - "\nhttps://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html"); + throw Error( + R"( + unable to start any build; + either increase '--max-jobs' or enable remote builds. + + for more information run 'man nix.conf' and search for '/machines' + )" + ); else - throw Error("unable to start any build; remote machines may not have " - "all required system features." - "\nhttps://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html"); + throw Error( + R"( + unable to start any build; + remote machines may not have all required system features. + + for more information run 'man nix.conf' and search for '/machines' + )" + ); } assert(!awake.empty());