From d916df777523d75f7c5acca79946652f032f633e Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 14 Sep 2025 16:04:29 +0200 Subject: [PATCH] nixos/make-options-doc: Remove now redundant fixup This fixes a problem where most NixOS option declaration paths started with `nixos/modules/nixos/modules/`, which should have been only just `nixos/modules/`. Since dcc0ee9ea10ddfb31f1eb4827379ef0aa91e95d5, we use a source path that includes both the `modules` and `nixos/modules`, so we don't need to additionally prefix `nixos/modules` anymore. Manually checked with nix-build nixos/release.nix -A options jq < result/share/doc/nixos/options.json '[ ."_module.args".declarations, ."meta.maintainers".declarations, ."nixpkgs.system".declarations, ."zramSwap.swapDevices".declarations ]' Samples: - `_module` for options defined in `lib/` - `meta.maintainers` for options defined in `modules/` - `nixpkgs.system` for options defined in `nixos/` with `meta.buildDocsInSandbox = false;` - `zramSwap.swapDevices` for regular `nixos/` without that I'm a big fan of automated tests, but in this case I am not doing that because - the solution is a simplification, and - no obvious place for the test, and it would couple with unrelated downstream code more than I would like. --- nixos/lib/make-options-doc/mergeJSON.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nixos/lib/make-options-doc/mergeJSON.py b/nixos/lib/make-options-doc/mergeJSON.py index 4be83fcb827b..f6dd81d0f780 100644 --- a/nixos/lib/make-options-doc/mergeJSON.py +++ b/nixos/lib/make-options-doc/mergeJSON.py @@ -52,12 +52,6 @@ for arg in sys.argv[1:]: options = pivot(json.load(open(sys.argv[1 + optOffset], 'r'))) overrides = pivot(json.load(open(sys.argv[2 + optOffset], 'r'))) -# fix up declaration paths in lazy options, since we don't eval them from a full nixpkgs dir -for (k, v) in options.items(): - # The _module options are not declared in nixos/modules - if v.value['loc'][0] != "_module": - v.value['declarations'] = list(map(lambda s: f'nixos/modules/{s}' if isinstance(s, str) else s, v.value['declarations'])) - # merge both descriptions for (k, v) in overrides.items(): cur = options.setdefault(k, v).value