hosts:virtual_machines:nixbuild:nix_build_server
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
hosts:virtual_machines:nixbuild:nix_build_server [2023/03/10 02:39] – tcmal | hosts:virtual_machines:nixbuild:nix_build_server [2023/08/25 23:11] (current) – removed tcmal | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | [[meta: | ||
- | ===== Nix Build Server ===== | ||
- | ^ Name | Nix Build Server | | ||
- | ^ Ports | 22 (tcp) | | ||
- | ^ | [[https:// | ||
- | [[meta: | ||
- | This VM is intended to function mainly as a Nix build server. Because of Nix's sandboxing, it's possible to have it upload your source code (and Nix instructions), | ||
- | |||
- | Currently, this is only available to admins, because remote builds require trusted-user and this is equivalent to root. Once [[https:// | ||
- | |||
- | ==== Usage ==== | ||
- | |||
- | |||
- | To try this out, first setup [[howto:: | ||
- | |||
- | Once you have that, check connectivity with '' | ||
- | |||
- | You can now run nix builds remotely, for example: | ||
- | |||
- | < | ||
- | $ nix build --impure --expr ' | ||
- | --builders ' | ||
- | --rebuild --max-jobs 0 `# Force it to happen, and remotely` | ||
- | </ | ||
- | |||
- | === Remote builds vs remote stores === | ||
- | |||
- | |||
- | Running this, you might notice two things: | ||
- | |||
- | - Each dependency is downloaded locally, then uploaded to the build server, possibly resulting in a long time before anything gets built. | ||
- | - We download the end result, and all of its runtime dependencies | ||
- | |||
- | (1) is easily solved by adding '' | ||
- | |||
- | (2) happens because Nix assumes we want to use the thing we've just built, but if we just want it to be in a binary cache then this might not be the case. To fix this, we have to make Nix use our server as a //remote store// rather than just a remote build server: | ||
- | |||
- | < | ||
- | $ nix build --impure --expr ' | ||
- | --builders ' | ||
- | --eval-store auto --store ' | ||
- | --rebuild --max-jobs 0 `# Force it to happen, and remotely` | ||
- | </ | ||
- | |||
- | Later you can use '' | ||
- | |||
- | [[https:// | ||
- | |||
- | === Saving details === | ||
- | |||
- | If you're only going to build Nix stuff using this, you can add '' | ||
- | |||
- | You can also set the environment variable '' |
hosts/virtual_machines/nixbuild/nix_build_server.1678415968.txt.gz · Last modified: 2023/03/10 02:39 by tcmal