A collection of useful Nix native plugins.
This plugin adds a setting extra-builtins-file
and two builtins:
builtins.extraBuiltins
: If theextra-builtins-file
exists, it is imported and passed a set containing at least theimportNative
andexec
primops, even ifallow-unsafe-native-code-during-evaluation
isfalse
, and the result is available asextraBuiltins
. If the file does not exist,extraBuiltins
will benull
.builtins.nix-cflags
: A set of required flags needed to build a native plugin against the same version of Nix this plugin is compiled against. See nix-plugins-config.h.in for the list of attributes in the set.
This allows users to specify a fixed set of safe extra builtins
without enabling arbitrary Nix expressions to run arbitrary native
code. The expectation is that extra-builtins-file
defines a set of
builtins, but ultimately that's up to the end user.
To enable these plugins system-wide on NixOS, add the following to your configuration:
nix.extraOptions = ''
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
'';