Skip to content

lib.types: add types.option#499945

Merged
roberth merged 2 commits into
NixOS:masterfrom
KiaraGrouwstra:types-option
Apr 8, 2026
Merged

lib.types: add types.option#499945
roberth merged 2 commits into
NixOS:masterfrom
KiaraGrouwstra:types-option

Conversation

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor

@KiaraGrouwstra KiaraGrouwstra commented Mar 14, 2026

i noticed that while we had a types.optionType, describing what goes into a module system type, we seemingly did not yet have a type to describe an actual module system option itself.
this change fills that gap.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci Bot requested review from hsjobeki, infinisil and roberth March 14, 2026 23:28
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Mar 14, 2026
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/6555

@roberth
Copy link
Copy Markdown
Member

roberth commented Apr 1, 2026

🤨 With great power comes great responsibility!

Could you document this? And maybe add something that we generally prefer to avoid this type because it's a form of metaprogramming, making it harder to reason about a module.

(For context, not sure if that's applicable here, but I vehemently oppose the practice of "undocumenting" questionable features, which is subjective in the first place. If someone thinks it's questionable, that means they have something useful to say in the docs!)

@nixpkgs-ci nixpkgs-ci Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation labels Apr 1, 2026
Comment thread lib/types.nix Outdated
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 3, 2026
@hsjobeki
Copy link
Copy Markdown
Contributor

hsjobeki commented Apr 3, 2026

I wonder why a deferredModule is not sufficient? Encapsulating one or more options into a deferredModule, importing it along, where you need it?

@KiaraGrouwstra
Copy link
Copy Markdown
Contributor Author

this type i'd hoped for for #500287.
y'all may well know more considerations from the module system perspective.

@roberth roberth added this pull request to the merge queue Apr 8, 2026
Merged via the queue into NixOS:master with commit 8d4e372 Apr 8, 2026
30 of 32 checks passed
@KiaraGrouwstra KiaraGrouwstra deleted the types-option branch April 8, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants