Skip to content

lib/modules: Add mkTransform#155903

Closed
roberth wants to merge 1 commit intoNixOS:masterfrom
hercules-ci:module-system-mkTransform
Closed

lib/modules: Add mkTransform#155903
roberth wants to merge 1 commit intoNixOS:masterfrom
hercules-ci:module-system-mkTransform

Conversation

@roberth
Copy link
Member

@roberth roberth commented Jan 20, 2022

Motivation for this change

Allow configs to transform defaults by means of a function, allow "mkForce" to transform regular configs.

Draft because of remaining questions:

  • Is this something we want or a symptom of bad module design?

  • Should mkTransform produce an override or its own type? Is it ok to peek inside a mkForce value to look for a transform object, or would that be too strict?

  • What is the performance impact?

TODO (assuming boring answers to the questions):

  • add mkForcePriority etc
  • add docs
  • fix systemd's use of what should be module system internals

cc @infinisil

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

A means of transforming default values.
@roberth roberth added 6.topic: module system About "NixOS" module system internals 6.topic: user experience NixOS / Nixpkgs end user experience labels Jan 20, 2022
@infinisil infinisil mentioned this pull request Jan 28, 2022
13 tasks
@roberth
Copy link
Member Author

roberth commented Jan 30, 2022

Closing, because while this is a better solution than #157070, it moves the module system in the wrong direction. See #157070 (comment)

@roberth roberth closed this Jan 30, 2022
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/scalpel-minimally-invasive-secrets-provisioning-to-generated-config-files/19845/2

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/natural-deduction-rules-for-the-nixos-module-merge/26513/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: module system About "NixOS" module system internals 6.topic: user experience NixOS / Nixpkgs end user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants