Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E012: Angle Bracket Import

Severity: Warning

cannot resolve angle bracket import `<nixpkgs>` -- add a type annotation or stub

An import <path> expression uses an angle bracket path, which requires NIX_PATH resolution. Tix does not implement NIX_PATH lookup, so the imported value’s type is unknown.

Automatically resolved paths

When the default stubs are loaded, tix automatically resolves these common angle bracket imports:

PathResolved type
<nixpkgs>{ ... } -> Pkgs — the nixpkgs top-level function
<nixpkgs/lib>Lib — the nixpkgs lib attrset

These use the Pkgs and Lib type aliases from the built-in stubs (stubs/lib.tix). No annotation or configuration is needed for these imports — they just work.

Common causes

This warning appears for angle bracket imports that tix cannot resolve automatically:

  • Custom Nix search path entries like <unstable>, <nixos>, or <home-manager>.
  • Nixpkgs subpaths other than lib, such as <nixpkgs/nixos/lib/eval-config.nix>.

How to fix

  • Add a type annotation to the binding:
    /** type: pkgs :: Pkgs */
    pkgs = import <nixpkgs> {};
    
    /** type: lib :: Lib */
    lib = import <nixpkgs/lib>;
    
  • Or configure a context in tix.toml so module parameters are typed automatically, avoiding the need to import with angle brackets in the first place.
  • Load stubs that define the Pkgs and Lib type aliases.