NixOS modules' options exposed #195

Open
opened 2025-02-24 11:54:55 +01:00 by kiara · 3 comments
Owner

As a Fediversity user,
I want Fediversity to expose NixOS service modules' configuration options,
so that I may better control my deployments.

notes

  • Any options exposed to the user may increase the risk of backward-incompatible changes, see #629. Moreover, migrating those exposed thru settings may need the applications' schemas (#627) to migrate.
  • Potential copes (may not scale well) against migrations include:
    • patching needed configuration options from build to run-time
    • minimize exposed options in favor of hard-coding sane defaults
      • to facilitate this approach: using abstractions, including contracts (#369) or custom ones

implementation notes

  • may need better conversion from nix option modules (#626).
  • definition of done: our currently implemented applications (can) expose their full nixos modules in the form, or whatever subsets thereof could make sense in our setting (#1245).
    • NixOS modules are exposed as module-schema-generated JSON-Schema build by flake attribute core#frontend-configuration-schema as exposed thru our existing REST end-point, based on data-model.nix's front-end configurations which exposes applications' operator-facing options.
    • used nixpkgs revision is our nixpkgs pin in npins/sources.json as normal, i.e. different versions (relevant in #100) remain out of scope here
    • changing implementations of module-schema we handle by accordingly updating nix-module-form to account for these changes
**As** a Fediversity user, **I want** Fediversity to expose NixOS service modules' configuration options, **so that** I may better control my deployments. ## notes - Any options exposed to the user may increase the risk of backward-incompatible changes, see #629. Moreover, migrating those exposed thru `settings` may need the applications' schemas (#627) to migrate. - Potential copes (may not scale well) against migrations include: - patching needed configuration options from build to run-time - minimize exposed options in favor of hard-coding sane defaults - to facilitate this approach: using abstractions, including contracts (#369) or custom ones ### implementation notes - may need better conversion from nix option modules (#626). - **definition of done**: our currently implemented applications (can) expose their full nixos modules in the form, or whatever subsets thereof could make sense in our setting (#1245). - NixOS modules are exposed as `module-schema`-generated JSON-Schema build by flake attribute `core#frontend-configuration-schema` as exposed thru our existing REST end-point, based on `data-model.nix`'s front-end configurations which exposes applications' operator-facing options. - used nixpkgs revision is our nixpkgs pin in `npins/sources.json` as normal, i.e. different versions (relevant in #100) remain out of scope here - changing implementations of [module-schema](https://git.fediversity.eu/fediversity/module-schema) we handle by accordingly updating `nix-module-form` to account for these changes
kiara changed title from use json schema as common language between components to expose configuration options from schema 2025-05-27 14:36:52 +02:00
kiara changed title from expose configuration options from schema to upstream configuration options exposed through schema 2025-06-01 13:34:31 +02:00
kiara changed title from upstream configuration options exposed through schema to upstream configuration options exposed 2025-06-01 13:35:24 +02:00
kiara changed title from upstream configuration options exposed to NixOS modules' options exposed 2025-12-03 15:15:40 +01:00
kerstin self-assigned this 2026-07-01 15:30:30 +02:00
Member

In the meeting on 2026-07-14 @toonn, @kiara and I talked about the problem of some NixOS options depending on config, like e.g. the default value of services.mastodon.redis.host.

This is a problem since we wanna show a form based on jsonschema to the operator, but that jsonschema can't be dependend on the operators input (what eventually becomes the value of config) for latency reasons.

We figured that it is a practical way to move forward for now, by making the jsonschema of a form only dependend on the current nixpkgs checkout, not on the user supplied form input.

That implies that we have to generate jsonschema from NixOS options at runtime (since the Nixkpgs checkout of a deployment changes at runtime), but we can easily cache these, since the Nixpkgs checkout only changes ~once a day.

In the meeting on 2026-07-14 @toonn, @kiara and I talked about the problem of some NixOS options depending on `config`, like e.g. the default value of [`services.mastodon.redis.host`](https://search.nixos.org/options?channel=26.05&query=mastodon.redis.host&type=options#show=option%253Aservices.mastodon.redis.host). This is a problem since we wanna show a form based on jsonschema to the operator, but that jsonschema can't be dependend on the operators input (what eventually becomes the value of `config`) for latency reasons. We figured that it is a practical way to move forward for now, by making the jsonschema of a form only dependend on the current nixpkgs checkout, *not* on the user supplied form input. That implies that we have to generate jsonschema from NixOS options at runtime (since the Nixkpgs checkout of a deployment changes at runtime), but we can easily cache these, since the Nixpkgs checkout only changes ~once a day.
Member

Agree, with one caveat, some options are expected to be set by the Hosting Provider and should not be shown to Operators. If the Hosting Provider config is in Nix then we could implement this by doing a set difference between the module options and the Hosting Provider's config and we'd generate the schema based on that instead. Not quite as static but the Hosting Provider shouldn't change too frequently, hopefully?

If we don't have the Hosting Provider configure in Nix then backend or frontend would have to do this set difference or get an explicit description of options to show to the Operator somehow.

Agree, with one caveat, some options are expected to be set by the Hosting Provider and should not be shown to Operators. If the Hosting Provider config is in Nix then we could implement this by doing a set difference between the module options and the Hosting Provider's config and we'd generate the schema based on that instead. Not quite as static but the Hosting Provider shouldn't change too frequently, hopefully? If we don't have the Hosting Provider configure in Nix then backend or frontend would have to do this set difference or get an explicit description of options to show to the Operator somehow.
Author
Owner

since #1071 we have some type of schema diffing like that based on configuration set by the hosting provider

since #1071 we have some type of schema diffing like that based on configuration set by the hosting provider
toonn added this to the Dev project 2026-08-04 11:57:30 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 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
fediversity/fediversity#195
No description provided.