Feature Request: Show changes in NixOS option definitions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 323
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
It could be very helpful to see changes in option definitions, whenever a new NixOS module is added or changed in a pull request.
For example, a recent pull request has accidentally enabled Docker by default.
Given that modules could change any other option definition, I think it's a good idea to have a diff of the changed option definitions during review of the pull request.
As an (very raw and unpolished) example, something like this can be used with nix-instantiate --strict --json --eval thefollowingfile.nix from the nixpkgs root to spit out JSON that can be diffed against the output when run against the previous version of nixpkgs:
let
lib = import ./lib;
inherit (import ./nixos/lib/eval-config.nix {
modules = [];
}) options;
sanitise = type: val: let
typename = type.name or null;
subtype = type.functor.wrapped or null;
in if typename == "path" then null
else if lib.isList val then map (sanitise subtype) val
else if lib.isFunction val then "<function>"
else if lib.isDerivation val then "<derivation ${val.name}>"
else if lib.isAttrs val then lib.attrNames val
else if lib.isBool val || lib.isInt val || isNull val then val
else toString val;
recurseCond = opt: !lib.isOption opt;
sanitiseOpt = path: opt: let
eval = builtins.tryEval (sanitise opt.type opt.definitions);
in if opt ? definitions then eval.value else null;
in lib.mapAttrsRecursiveCond recurseCond sanitiseOpt options
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides no ofborg file or test entry point. Start by running the provided nix-instantiate expression from the nixpkgs root and reading nixos/lib/eval-config.nix; define the desired option-definition diff output and pull-request review integration, with a clear example of the Docker default change as the completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nixos
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100