automatically import ${namespace}.${class} as module #9

Merged
horscchtey merged 1 commit from nonapode/auto-import into main 2025-11-26 19:48:21 +01:00
Owner

As we moved on to a pattern where we have multiple repositories and a host repository to collect these to merge them into one final configuration we have a lot of redundancy:

  • adding the input as url to the main repo
  • providing a module by the sub-repo to be usable by the main repo
  • load the module from the sub-repo in the main repo
  • configure the module options (from the main-repo)

This will change will help in this regard so that the sub-repo can specify the configuration as well for class in an output ${namespace}.${class} module that is automatically loaded.
So the main-repo will only specify the sub-repo as an input and automatically will load whatever is specified in that repo for the classes set for this host (by default the hostname).

So one might have a git-sub-repo fbs42:nixos/mail that has the following outputs:

  • fbs42.mail-server: a module that configures the @fbs42.ddnss.de mail-server infrastructure
  • fbs42.mail-client: a module that configures sendmail to send @fbs42.ddnss.de addresses
    This repository might now be used by several hosts, e.g.
  • host/scarif.nix:classes = [ "mail-server" "mail-client" ]
  • host/ruediger.nix:classes = [ "mail-client" ]
  • host/kashyyyk.nix:classes = [ "mail-client" ]
As we moved on to a pattern where we have multiple repositories and a host repository to collect these to merge them into one final configuration we have a lot of redundancy: - adding the input as url to the main repo - providing a module by the sub-repo to be usable by the main repo - load the module from the sub-repo in the main repo - configure the module options (from the main-repo) This will change will help in this regard so that the sub-repo can specify the configuration as well for class in an output ${namespace}.${class} module that is automatically loaded. So the main-repo will only specify the sub-repo as an `input` and automatically will load whatever is specified in that repo for the classes set for this host (by default the hostname). So one might have a git-sub-repo fbs42:nixos/mail that has the following outputs: - fbs42.mail-server: a module that configures the @fbs42.ddnss.de mail-server infrastructure - fbs42.mail-client: a module that configures sendmail to send @fbs42.ddnss.de addresses This repository might now be used by several hosts, e.g. - host/scarif.nix:classes = [ "mail-server" "mail-client" ] - host/ruediger.nix:classes = [ "mail-client" ] - host/kashyyyk.nix:classes = [ "mail-client" ]
Allow to specify a list of classes in the host/<hostname>.nix (by
default the class <hostname> is used) that will automatically load
specified outputs of inputs.
horscchtey changed target branch from nonapode/nixfmt to main 2025-11-26 19:35:43 +01:00
horscchtey approved these changes 2025-11-26 19:48:12 +01:00
horscchtey deleted branch nonapode/auto-import 2025-11-26 19:48:21 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
nixos/base!9
No description provided.