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

Module Options

imp.args

Type: attribute set of unspecified value

Default: { }

Extra arguments passed to all imported files.

Flake files receive: { lib, self, inputs, config, imp, registry, ... } perSystem files receive: { pkgs, lib, system, self, self', inputs, inputs', imp, registry, ... }

User-provided args take precedence over defaults.

imp.flakeFile.enable

Type: boolean

Default: false

Whether to enable flake.nix generation from __inputs declarations.

Example: true

imp.flakeFile.coreInputs

Type: attribute set of unspecified value

Default: { }

Core inputs always included in flake.nix (e.g., nixpkgs, flake-parts).

Example:

{
  nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  flake-parts.url = "github:hercules-ci/flake-parts";
}

imp.flakeFile.description

Type: string

Default: ""

Flake description field.

imp.flakeFile.header

Type: string

Default:

''
  # Auto-generated by imp - DO NOT EDIT
  # Regenerate with: nix run .#imp-flake''

Header comment for generated flake.nix.

imp.flakeFile.outputsFile

Type: string

Default: "./outputs.nix"

Path to outputs file (relative to flake.nix).

imp.flakeFile.path

Type: absolute path

Default: self + "/flake.nix"

Path to flake.nix file to generate/check.

imp.perSystemDir

Type: string

Default: "perSystem"

Subdirectory name for per-system outputs.

Files in this directory receive standard flake-parts perSystem args: { pkgs, lib, system, self, self', inputs, inputs', ... }

imp.registry.migratePaths

Type: list of absolute path

Default: [ ]

Directories to scan for registry references when detecting renames. If empty, defaults to [ imp.src ] when registry.src is set.

Example:

[ ./nix/outputs ./nix/flake ]

imp.registry.modules

Type: attribute set of unspecified value

Default: { }

Explicit module name -> path mappings. These override auto-discovered modules from registry.src.

Example:

{
  specialModule = ./path/to/special.nix;
}

imp.registry.name

Type: string

Default: "registry"

Attribute name used to inject the registry into file arguments.

Change this if "registry" conflicts with other inputs or arguments.

Example:

"impRegistry"
# Then in files:
# { impRegistry, ... }:
# { imports = [ impRegistry.modules.home ]; }

imp.registry.src

Type: null or absolute path

Default: null

Root directory to scan for building the module registry.

The registry maps directory structure to named modules. Files can then reference modules by name instead of path.

Example:

./nix
# Structure:
#   nix/
#     users/alice/     -> registry.users.alice
#     modules/nixos/   -> registry.modules.nixos
#
# Usage in files:
#   { registry, ... }:
#   { imports = [ registry.modules.home ]; }

imp.src

Type: null or absolute path

Default: null

Directory containing flake outputs to import.

Structure maps to flake-parts semantics: outputs/ perSystem/ -> perSystem.* (per-system outputs) packages.nix -> perSystem.packages devShells.nix -> perSystem.devShells nixosConfigurations/ -> flake.nixosConfigurations overlays.nix -> flake.overlays systems.nix -> systems (optional, overrides top-level)

imp.hosts.enable

Type: boolean

Default: false

Whether to enable automatic nixosConfigurations from __host declarations.

When enabled, imp scans hosts.sources for files containing __host attrsets and generates flake.nixosConfigurations entries automatically.

Example: true

imp.hosts.sources

Type: list of absolute path

Default: [ ]

Directories to scan for __host declarations.

Each .nix file with a __host attrset becomes a nixosConfiguration. The host name derives from the directory name (for default.nix) or filename (for other files). Files in directories starting with _ are excluded.

By default, scans registry.src if set.

Example:

[ ./nix/registry/hosts ]

imp.hosts.defaults

Type: attribute set of unspecified value

Default: { }

Default values applied to all host declarations.

Host-specific values in __host override these defaults. Useful for setting system or stateVersion once rather than repeating in every host file.

Example:

{
  system = "x86_64-linux";
  stateVersion = "24.11";
}