Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module system: Improve error messages around faulty imports #197547

Merged
merged 23 commits into from
May 6, 2023

Commits on May 6, 2023

  1. lib/tests/modules.sh: Unload implicit modules

    I had some trouble understanding this. Let's try to keep new tests
    a bit more stateless and explicit.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    e7e6423 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fe15279 View commit details
    Browse the repository at this point in the history
  3. lib/modules.nix: Make some functions private

    The supposedly public nature of these functions has been holding
    back module system maintenance, while usages of these functions
    are expected to be rare. If used anywhere, presumably they're
    emulating module system behavior because some use case isn't supported
    properly. We should try to support such a use case directly, if it
    even exists.
    roberth committed May 6, 2023
    1 Configuration menu
    Copy the full SHA
    3633bf9 View commit details
    Browse the repository at this point in the history
  4. lib/modules: Add class concept to check imports

    This improves the error message when an incompatible module is
    imported.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    b8ff280 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    58f385f View commit details
    Browse the repository at this point in the history
  6. lib/modules: Improve error when a configuration is imported

    This is appears to be a fairly common mistake for beginners who want
    to build larger things from the system configurations, such as NixOps
    networks, etc. Further explanation seems appropriate.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    2e689d5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9714487 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    439f679 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    06ca786 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1f4a58e View commit details
    Browse the repository at this point in the history
  11. lib/modules: Only interpret class declaration in non-shorthand mode

    This is to avoid stealing keys from submodules. `class` might be
    common enough that reinterpreting existing `class` attributes in
    configurations as a declaration leads to fairly widespread problems.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    84b1b01 View commit details
    Browse the repository at this point in the history
  12. nixos,nixpkgs: Add module classes

    This allows modules that declare their class to be checked.
    While that's not most user modules, frameworks can take advantage
    of this by setting declaring the module class for their users.
    That way, the mistake of importing a module into the wrong hierarchy
    can be reported more clearly in some cases.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    79703ee View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    ee1e14b View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    03a465f View commit details
    Browse the repository at this point in the history
  15. lib/modules.nix: Deduplicate documentation

    `file://./..` looks redundant, but makes the url clickable in vscode.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    73f584c View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    5fac393 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    8f02e95 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    8054785 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    7459c02 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    fd88c79 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    4c7aa7d View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    89491be View commit details
    Browse the repository at this point in the history
  23. lib.modules: configurationClass -> class

    This simplifies the documentation. `configuration` is implied by `_type`.
    roberth committed May 6, 2023
    Configuration menu
    Copy the full SHA
    eab660d View commit details
    Browse the repository at this point in the history