dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

Initialize nixos module system. (translators only)

Open DavHau opened this issue 3 years ago • 0 comments

This initializes the structure for a potentially fully nixos modules based dream2nix framework. For now only the translators and some related functionality is migrated as a test to allow for reviews.

In the future, further functionality could/should be migrated to /src/modules.

Why we want this?:

  • type checked internal and external interfaces
  • automatically documented interfaces
  • better extensibility of the framework
  • simplify structure of the dream2nix source code

Concerning the file structure:

The idea is that /src/modules is a flat structure of directories. It should be easy to find the source of an option definition by knowing the option attribute path. For example the option functions.translators.{something} can be found in /src/modules/functions.translators Every file in /src/modules/{category} should contain an interface.nix and an implementation.nix. This should make it easy to quickly find the interface definition as a contributor.

Transition phase:

With this, now the framework is a mix of nixos-modules and not nixos-modules. That is a bit ugly, but we have no better way other than slowly transitioning to the new structure, and letting both old and new structure access each other.

Currently the nixos modules pieces, can access the old non-module pieces by using the specialArgs dlib and callPackageDream. The non nixos-modules pieces can access the modules via the framework attribute which is brought in scope via callPackageDream.

@yusdacra It would be great if you could review this since you had implemented the current custom module loading logic. Now is the time to really optimize the new structure, before we decide to move more stuff over.

@infinisil In case you have time to have a quick look at this, it would be great. If not, don't worry.

DavHau avatar Aug 12 '22 18:08 DavHau