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

flake-parts.touchup

Controls which attributes appear in the flake output and how they are transformed.

The touchup configuration forms a tree that mirrors the flake output structure. At each level, attr targets specific attributes by name, and any applies to all attributes at that level. Attributes can be removed (enable = false) or post-processed (finish).

This is useful for hiding attributes from nix flake check or nix flake show that are only meant for internal use, or for working around strictness issues in the Nix CLI.

Installation

To use these options, add inside the mkFlake:

imports = [
  inputs.flake-parts.flakeModules.touchup
];

Run nix flake lock and you’re set.

Options

touchup

Controls which attributes appear in processedFlake and how they are transformed.

The touchup configuration forms a tree that mirrors the flake output structure. At each level, attr targets specific attributes by name, and any applies to all attributes at that level.

Examples:

Only output explicitly listed flake output attributes:

touchup = {
  any = {
    enable = lib.mkDefault false;
  };
  attr.packages.enable = true;
  attr.checks.enable = true;
}

Hide a package from users, but not from your own modules:

touchup = {
  attr.packages.any.attr.hello.enable = false;
};

Hide a package on a set of systems:

touchup = {
  attr.packages.any = { attrName, ... }: { attr.hello.enable = ! lib.strings.hasSuffix "-darwin" attrName; }
};

Type: submodule

Declared by:

touchup.any

A module whose options are merged into every attribute’s touchup configuration. For example, any.enable = false disables all attributes by default. Override specific ones via attr.<name>.

Only applies to immediate children — does not recurse into nested attributes automatically.

This module is called with module argument attrName, which is the name of the attribute being touched up.

Type: null or module

Default:

null

Declared by:

touchup.any.enable

Whether to include the attribute in the output.

Type: boolean

Default:

true

Declared by:

touchup.any.any

Default configuration for all attributes at the next level. Same structure as any; see its description.

Type: null or module

Default:

null

Declared by:

touchup.any.attr

Touchup configuration for the next level of nesting. Same structure as attr; see its description.

Type: lazy attribute set of module

Default:

{ }

Declared by:

touchup.any.finish

A function applied after filtering and transforming (e.g. by touchup.any.attr and touchup.any.any at this level). It receives the resulting attribute set and must return the value to use in its place.

Type: function that evaluates to a(n) raw value

Default: v: v, the identity function

Declared by:

touchup.any.type

The type used for merging multiple definitions of touchup.any.finish. Override this if multiple modules need to compose their touchup.any.finish functions.

Type: raw value

Default:

"raw"

Declared by:

touchup.attr

Per-attribute touchup configuration. Each value is a module that controls whether and how the corresponding attribute appears in the output.

Each module contains the full touchup option set (enable, attr, any, finish), so nested attributes can be configured to arbitrary depth.

This module is called with module argument attrName, which is the name of the attribute being touched up.

Type: lazy attribute set of module

Default:

{ }

Declared by:

touchup.attr.<name>.enable

Whether to include the attribute in the output.

Type: boolean

Default:

true

Declared by:

touchup.attr.<name>.any

Default configuration for all attributes at the next level. Same structure as any; see its description.

Type: null or module

Default:

null

Declared by:

touchup.attr.<name>.attr

Touchup configuration for the next level of nesting. Same structure as attr; see its description.

Type: lazy attribute set of module

Default:

{ }

Declared by:

touchup.attr.<name>.finish

A function applied after filtering and transforming (e.g. by touchup.attr.<name>.attr and touchup.attr.<name>.any at this level). It receives the resulting attribute set and must return the value to use in its place.

Type: function that evaluates to a(n) raw value

Default: v: v, the identity function

Declared by:

touchup.attr.<name>.type

The type used for merging multiple definitions of touchup.attr.<name>.finish. Override this if multiple modules need to compose their touchup.attr.<name>.finish functions.

Type: raw value

Default:

"raw"

Declared by:

touchup.finish

A function applied after filtering and transforming (e.g. by touchup.attr and touchup.any at this level). It receives the resulting attribute set and must return the value to use in its place.

Type: function that evaluates to a(n) raw value

Default: v: v, the identity function

Declared by:

touchup.type

The type used for merging multiple definitions of touchup.finish. Override this if multiple modules need to compose their touchup.finish functions.

Type: raw value

Default:

"raw"

Declared by: