Skip to content

API Reference

nixy.eval

The main entry point. Takes a configuration attrset, returns the evaluated result.

nix
nixy.eval {
  inherit (nixpkgs) lib;
  imports ? [ ];
  args ? { };
  exclude ? null;
}

Parameters:

ParameterDescription
libNixpkgs lib (e.g. nixpkgs.lib)
importsDirectories, .nix files, attrsets, or lists thereof
argsExtra arguments available in all modules (see below)
exclude{ name, path } -> bool — return true to skip a file during scanning

Returns:

nix
{
  nodes.<n> = {
    module = { ... };   # Module bundle — pass to nixosSystem, darwinSystem, etc.
    schema = { ... };   # Evaluated schema values for this node
  };
  extend = { ... };     # Layer additional imports (see below)
}

Users can contribute additional data to the result via _result in their configuration files.

extend

Layer additional imports and args onto an existing evaluation:

nix
cluster.extend {
  imports ? [ ];   # Additional imports to merge
  args ? { };      # Additional args (merged with //)
  exclude ? null;  # Override the exclude function
}

Returns a new result with the same shape. The original evaluation is not modified.

args

Values passed via args are available in both nixy-level files (schema/traits/nodes definitions) and inside trait and include modules.

Top-level Options

These options are available in every loaded .nix file:

OptionTypeDescription
schemadeep-merged attrsetOption declarations (the knobs)
traitsattrsOf rawBehavior units (name = key, value = module)
nodeslazyAttrsOf submoduleTarget definitions

Nodes use a lazy attribute set type, so accessing one node does not force evaluation of others.

Node Fields

Each node accepts:

FieldTypeDefaultDescription
traitslist of strings[ ]Trait names to activate
schemasubmodule{ }Values matching global schema
includeslist of raw[ ]Extra modules (paths, attrsets, or functions)

Trait Structure

A trait's key is its name, and the value is a module (path, function, or attribute set). Duplicate names across files are caught by the module system.

nix
traits.ssh =
  { schema, config, pkgs, lib, ... }:
  {
    # Configuration
  };

Module Arguments

Inside trait and include modules, these framework arguments are available alongside standard module args (config, pkgs, lib, ...):

ArgumentDescription
nameThe node's attribute name
schemaEvaluated schema values for this node
nodesAll nodes' { schema, traits } for cross-references

Plus everything passed via args to nixy.eval.

Scanning Defaults

Files excluded by default: names starting with _ or ., flake.nix, default.nix.