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: "./nix/flake"

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.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 registry.src for files containing __host attrsets and generates flake.nixosConfigurations entries automatically.

Example: true

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";
}

imp.impShell.enable

Type: boolean

Default: false

Whether to enable auto-generated default devShell.

When enabled and no explicit devShells.default is defined, imp creates one that uses inputsFrom to include all other devShells. This eliminates boilerplate for the common case where you want all devShell contributions merged together.

Example: true

# In your flake config:
imp.impShell.enable = true;

# Bundles can contribute devShells:
# nix/bundles/rust/default.nix
{
  __outputs.perSystem.devShells.rust = pkgs.mkShell { ... };
}

# nix/bundles/bevy/default.nix
{
  __outputs.perSystem.devShells.bevy = pkgs.mkShell { ... };
}

# imp auto-generates:
# devShells.default = mkShell {
#   inputsFrom = [ self'.devShells.rust self'.devShells.bevy ... ];
# };