Module Arguments

Each of your NixOS, nix-darwin and home-manager modules implicitly receive a specialArgs called flake.

The components of this flake attrset are:

NameDescription
inputsThe inputs of your flake; inputs.self referring to the flake itself
configThe flake-parts perSystem config

Here is an example of how these can be used:

{ flake, pkgs, lib, ... }:
let
  inherit (flake) config inputs;
  inherit (inputs) self;
in
{
  imports = [
    # Reference a flake input directly from a nix-darwin module
    inputs.agenix.darwinModules.default
  ];

  # Reference an arbitrary flake-parts config
  home-manager.users.${config.me.username} = { };
}

While the above example uses a nix-darwin module, you can do the same on NixOS or home-manager modules.