Skip to content

refactor(features): harden mkFeature option scoping, typing, and private-extension wiring - #38

Open
GDR wants to merge 5 commits into
masterfrom
refactor/feature-dsl-hardening
Open

GDR wants to merge 5 commits into
masterfrom
refactor/feature-dsl-hardening

Conversation

@GDR

@GDR GDR commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the follow-up architectural review items on mkFeature:

  1. Separate homeOptions and systemOptions (lib/features.nix):
    • Replaces extraOptions with homeOptions (exposed under hostUsers.<user>.modules.home.*) and systemOptions (exposed under options.modules.home.*).
    • Eliminates lib.recursiveUpdate between global and per-user featureCfg so per-user option defaults never overwrite global values.
    • Migrates steam to systemOptions and antigravity, zsh, git, and clavis to homeOptions.
  2. Strict Per-User Option Typing (modules/_core/user.nix):
    • Removes freeformType = types.attrsOf types.anything; from hostUsers.<user>.modules.
  3. Hard Dependency Validation (requires vs recommends):
    • Validates that all requires and recommends paths exist in moduleMap.
    • Throws an evaluation conflict error if an enabled feature transitively requires a module that the user explicitly disabled (enable = false), while still allowing enable = false to override category cascades and recommends.
  4. Private Extension Host Wiring & justfile Override:
    • Updates mkDarwinConfiguration and mkNixosConfiguration to accept hostName and append privateExtension.hosts.${hostName}.modules or [ ].
    • Wires DOT_PRIVATE_EXTENSION into justfile rebuild/check recipes.
  5. Opt-In User Privileges & Pure Evaluation:
    • Defaults hostUsers.<user>.extraGroups to [ ] and adds explicit trustedNixUser (default false).
    • Removes impure builtins.getEnv "CONTEXT7_API_KEY" from nix-goldstar.
  6. Documentation & Regression Checks:
    • Updates README.md and .agents/ skills to remove stale mkModuleV2 and home.core references.
    • Expands checks.nix with scoped-options-and-requires and unprivileged user assertions.

GDR added 5 commits October 26, 2026 18:45
…ions

- Separate per-user Home Manager options (homeOptions) from system-wide options (systemOptions) in mkFeature
- Scope option trees separately for options.modules.home and hostUsers.<user>.modules.home
- Pass per-user submodule config directly to Home Manager modules without recursiveUpdate clobbering
- Validate requires and recommends paths and throw evaluation error when a required dependency is explicitly disabled
- Migrate steam to systemOptions and antigravity, zsh, git, and clavis to homeOptions
- Remove freeformType fallback from hostUsers.<user>.modules submodule
- Change extraGroups default from [ "wheel" ] to [ ] and add explicit trustedNixUser option
- Enable trustedNixUser for dgarifullin in hosts/users/dgarifullin.nix
- Merge userDefaults.antigravity on nix-goldstar and remove impure CONTEXT7_API_KEY builtins.getEnv call
- Accept hostName in mkDarwinConfiguration and mkNixosConfiguration and append privateExtension.hosts.<host>.modules
- Pass --override-input private-extension when DOT_PRIVATE_EXTENSION is set in justfile
… conflicts

- Assert unprivileged user bob is excluded from wheel group and nix.settings.trusted-users
- Add scoped-options-and-requires check testing systemOptions, homeOptions, and hard requires conflict detection
- Replace remaining mkModuleV2 and home.core references in README.md and dotfiles-management skill
- Document homeOptions, systemOptions, and recommends in AGENTS.md and nix-module-creation skill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant