Where are options like `config.cudaSupport` documented?

Config options like

  pkgs = import (fetchTarball "https://github.com/samuela/nixpkgs/archive/cedb9abbb1969073f3e6d76a68da8835ec70ddb0.tar.gz") {
    config.allowUnfree = true;
    config.cudaSupport = true;
    config.cudnnSupport = true;
    config.asdfasdfasdfasdf = true;

Where are they documented?

Also why does nix allow me to pass config options that don’t exist like config.asdfasdfasdfasdf? (At least I’m assuming that flag is not implemented!)


I’m guessing that cudaSupport is a package attribute, but I can’t tell from your Nix expression what package this is for. Maybe you haven’t included the relevant part of the expression, or maybe you’re doing something I don’t understand yet. Anyway…

To learn about configurable package attributes, I usually start by searching on the NixOS search page. When I find the package, I…

  1. Click on the “homepage” link, hoping that the upstream developer knows about Nix/NixOS and tells us what we need to know. Often not, so next I…
  2. Click on the “source” link, which takes you to the nix expression in Nixpkgs. Usually I can figure out what it’s for there. Not the most elegant approach.

You can find most NixOS configuration options by searching on the same NixOS search page, but click on the “Options” tab instead.

The attributes for built-in functions are documented here:

Possibly useful:

config.cudaSupport is a nixpkgs-wide config option. It doesn’t appear in the search results on search.nixos.org, but is relevant to the functionality of many packages in the ecosystem, eg. tensorflow, jax, etc. See eg https://github.com/NixOS/nixpkgs/blob/93883402a445ad467320925a0a5dbe43a949f25b/pkgs/top-level/python-packages.nix#L8264-L8266 where cudaSupport is confusingly both a package attribute and a nixpkgs config option.


The Nixpkgs config is largely undeclared. The relevant file is nixpkgs/config.nix at 8758d58df0798db2b29484739ca7303220a739d3 · NixOS/nixpkgs · GitHub
config.allowAliases: Define as option by roberth · Pull Request #166792 · NixOS/nixpkgs · GitHub


Good catch, I also thought something needs to be done with discoverability of these things


I think there is some documentation here:

The code in that link is referring to package arguments, not config.foo options – although they frequently have overlapping names

I think the config.cudaSupport = boolean; is a package argument. But should have been better documented.

config.foo options are independent from package arguments, but oftentimes package arguments set them as default values… which can make things a little confusing

1 Like