nix plugins

Collection of miscellaneous plugins for the nix expression language

38
4
C++

nix-plugins

A collection of useful Nix native plugins.

extra-builtins

This plugin adds a setting extra-builtins-file and two builtins:

  • builtins.extraBuiltins: If the extra-builtins-file exists, it is
    imported and passed a set containing at least the importNative and
    exec primops, even if allow-unsafe-native-code-during-evaluation
    is false, and the result is available as extraBuiltins. If the
    file does not exist, extraBuiltins will be null.
  • 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.

Install

To enable these plugins system-wide on NixOS, add the following to your configuration:

nix.extraOptions = ''
  plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
'';