nixos-option
8
NixOS

# `nixos-option`

inspect a NixOS configuration

        nixos-option

          -v
          -d
          -l

        option.name

## Description

This command evaluates the configuration specified in `/etc/nixos/configuration.nix` and returns the properties of the option name given as argument. By default, it returns the value of the option.

When the option name is not an option, the command prints the list of attributes contained in the attribute set.

## Options

This command accepts the following options:

`--value`, `-v`

  Returns the value of the option. This is the default operation if no other options are defined.

`--description`, `-d`

  Return the default value, the example and the description of the option when available.

`--lookup`, `-l`

  Return the locations where the option is declared and where it is defined. This is extremely useful to find sources of errors in your configuration.

## Environment

`NIXOS_CONFIG`

  Path to the main NixOS configuration module. Defaults to `/etc/nixos/configuration.nix`.

## Examples

Investigate option values:

    $ nixos-option boot.loader
    This attribute set contains:
    generationsDir
    grub
    initScript

    $ nixos-option boot.loader.grub.enable
    true

Prints option information:

    $ nixos-option -d networking.hostName
    Default: "nixos"
    Description:
    The name of the machine. Leave it empty if you want to obtain
    it from a DHCP server (if using DHCP).

Find the locations which are declaring and defining an option:

    $ nixos-option -l hardware.firmware
    Declared by:
      /mnt/data/nix-sources/nixos/modules/services/hardware/udev.nix

    Defined by:
      /path/to/nixpkgs/nixos/modules/system/boot/kernel.nix
      /path/to/nixpkgs/nixos/modules/hardware/network/rt73.nix
      /path/to/nixpkgs/nixos/modules/hardware/network/intel-3945abg.nix
      /path/to/nixpkgs/nixos/modules/hardware/network/intel-2200bg.nix

## Bugs

The author listed in the following section is wrong. If there is any other bug, please report to Nicolas Pierron.