4 ms·
> I didn't even realize new builders are possible. Is this the only other one? The Nix Pills is the document I'd look to to understand what a builder is in Nix
by pxc 4y ago
> I didn't even realize new builders are possible. Is this the only other one?
The Nix Pills is the document I'd look to to understand what a builder is in Nix: https://nixos.org/guides/nix-pills/working-derivation.html https://nixos.org/guides/nix-pills/working-derivation.html
A builder is any program whose invocation is specified by a Nix derivation (think .drv file, specifically— not just any program that gets called in the course of a Nix build).
Most packages in Nixpkgs are defined using the stdenv.mkDerivation function, which uses a bash builder. This is why a lot of the arguments used in package definitions are bash snippets. They get interpolated and sourced and otherwise woven together to make the bash scripts that run the actual builds.
But for special purposes, it's not unusual to use builders in other languages, especially scripting languages, like Perl, Ruby, or Python. The first use case for special-purpose, non-bash builders that comes to mind for me is Nix code generation tools. When some enterprising Nixer writes a tool to partially or completely auto-generate Nix package definitions from the upstream packages native to their favorite language ecosystem, they often reach for that same language to do the job.
This experiment and the Oil/Nix RFC are about creating another reusable/extensible, general purpose builder that could be used to build many packages, so that snippets in the new shell language could play a similar role to the current role of bash snippets in Nixpkgs. For some, the hope is that eventually such builders could replace the prevalent bash builders in Nixpkgs!