nixos/docs: add a ctags script for nixos options#208173
Closed
lf- wants to merge 4 commits intoNixOS:masterfrom
Closed
nixos/docs: add a ctags script for nixos options#208173lf- wants to merge 4 commits intoNixOS:masterfrom
lf- wants to merge 4 commits intoNixOS:masterfrom
Conversation
Member
Author
|
things that should be fixed up:
|
lf-
added a commit
to lf-/nixpkgs
that referenced
this pull request
Aug 15, 2023
What it does: line and column level *declaration* position information:
$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationsWithLocations
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]
Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
declarations.
Related work:
- NixOS#65024
This one does it for all *definitions* rather than declarations, and
it was not followed through with due to performance worries.
- NixOS#208173
The basis for this change. This change is just a rebase of that one.
I split it out to add the capability before adding users of it, in
order to simplify review. However, the ctags script in there is a
sample user of this feature.
Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`
```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.971 s ± 0.254 s [User: 5.872 s, System: 1.388 s]
Range (min … max): 8.574 s … 9.327 s 10 runs
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.766 s ± 0.160 s [User: 5.873 s, System: 1.346 s]
Range (min … max): 8.496 s … 9.033 s 10 runs
```
Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
12 tasks
12 tasks
lf-
added a commit
to lf-/nixpkgs
that referenced
this pull request
Sep 8, 2023
What it does: line and column level *declaration* position information:
$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationPositions
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]
Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
declarations.
Related work:
- NixOS#65024
This one does it for all *definitions* rather than declarations, and
it was not followed through with due to performance worries.
- NixOS#208173
The basis for this change. This change is just a rebase of that one.
I split it out to add the capability before adding users of it, in
order to simplify review. However, the ctags script in there is a
sample user of this feature.
Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`
```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.971 s ± 0.254 s [User: 5.872 s, System: 1.388 s]
Range (min … max): 8.574 s … 9.327 s 10 runs
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.766 s ± 0.160 s [User: 5.873 s, System: 1.346 s]
Range (min … max): 8.496 s … 9.033 s 10 runs
```
Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
github-actions bot
pushed a commit
to arcnmx/nixpkgs-lib
that referenced
this pull request
Sep 18, 2023
What it does: line and column level *declaration* position information:
$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationPositions
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]
Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
declarations.
Related work:
- NixOS/nixpkgs#65024
This one does it for all *definitions* rather than declarations, and
it was not followed through with due to performance worries.
- NixOS/nixpkgs#208173
The basis for this change. This change is just a rebase of that one.
I split it out to add the capability before adding users of it, in
order to simplify review. However, the ctags script in there is a
sample user of this feature.
Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`
```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.971 s ± 0.254 s [User: 5.872 s, System: 1.388 s]
Range (min … max): 8.574 s … 9.327 s 10 runs
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.766 s ± 0.160 s [User: 5.873 s, System: 1.346 s]
Range (min … max): 8.496 s … 9.033 s 10 runs
```
Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
github-actions bot
pushed a commit
to nix-community/nixpkgs.lib
that referenced
this pull request
Sep 24, 2023
What it does: line and column level *declaration* position information:
$ nix repl .
nix-repl> :p nixosConfigurations.micro.options.environment.systemPackages.declarationPositions
[ { column = 7; file = "/nix/store/24aj3k7fgqv3ly7qkbf98qvphasrw9nb-source/nixos/modules/config/system-path.nix"; line = 63; } ]
Use cases:
- ctags over NixOS options, as will be presented at NixCon 2023 ;)
- improving the documentation pages to go to the exact line of the
declarations.
Related work:
- NixOS/nixpkgs#65024
This one does it for all *definitions* rather than declarations, and
it was not followed through with due to performance worries.
- NixOS/nixpkgs#208173
The basis for this change. This change is just a rebase of that one.
I split it out to add the capability before adding users of it, in
order to simplify review. However, the ctags script in there is a
sample user of this feature.
Benchmarks: conducted by evaluating my own reasonably complex NixOS
configuration with the command:
`hyperfine -S none -w 1 -- "nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath"`
```
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.971 s ± 0.254 s [User: 5.872 s, System: 1.388 s]
Range (min … max): 8.574 s … 9.327 s 10 runs
Benchmark 1: nix eval .#nixosConfigurations.snowflake.config.system.build.toplevel.outPath
Time (mean ± σ): 8.766 s ± 0.160 s [User: 5.873 s, System: 1.346 s]
Range (min … max): 8.496 s … 9.033 s 10 runs
```
Summary of results: it seems to be in the noise, this does not cause any
visible regression in times.
lf-
added a commit
to lf-/nixpkgs
that referenced
this pull request
Jan 7, 2024
This is rather a strawman of a PR to try to figure out the best spot to
put this code and the documentation of how to use it. I don't really
know.
Sample content:
```
!_TAG_FILE_SORTED 1 1
!_TAG_FILE_ENCODING utf-8 1
_module.args /home/jade/dev/nixpkgs/lib/modules.nix 122
_module.check /home/jade/dev/nixpkgs/lib/modules.nix 186
_module.freeformType /home/jade/dev/nixpkgs/lib/modules.nix 193
_module.specialArgs /home/jade/dev/nixpkgs/lib/modules.nix 209
appstream.enable /home/jade/dev/nixpkgs/nixos/modules/config/appstream.nix 6
assertions /home/jade/dev/nixpkgs/nixos/modules/misc/assertions.nix 9
boot.binfmt.emulatedSystems /home/jade/dev/nixpkgs/nixos/modules/system/boot/binfmt.nix 272
```
Sample usage (can be used in parallel with `nix-doc tags`):
```
nix build -f nixos/release.nix optionsCtags -o opts-tags
(in vim): :set tags+=opts-tags
:tj boot.binfmt.emulatedSystems
```
This PR depends on and contains NixOS#249243. Marked as draft till that's
worked out. This PR pair replaces NixOS#208173.
philiptaron
pushed a commit
to philiptaron/nixpkgs
that referenced
this pull request
Mar 4, 2024
This is rather a strawman of a PR to try to figure out the best spot to
put this code and the documentation of how to use it. I don't really
know.
Sample content:
```
!_TAG_FILE_SORTED 1 1
!_TAG_FILE_ENCODING utf-8 1
_module.args /home/jade/dev/nixpkgs/lib/modules.nix 122
_module.check /home/jade/dev/nixpkgs/lib/modules.nix 186
_module.freeformType /home/jade/dev/nixpkgs/lib/modules.nix 193
_module.specialArgs /home/jade/dev/nixpkgs/lib/modules.nix 209
appstream.enable /home/jade/dev/nixpkgs/nixos/modules/config/appstream.nix 6
assertions /home/jade/dev/nixpkgs/nixos/modules/misc/assertions.nix 9
boot.binfmt.emulatedSystems /home/jade/dev/nixpkgs/nixos/modules/system/boot/binfmt.nix 272
```
Sample usage (can be used in parallel with `nix-doc tags`):
```
nix build -f nixos/release.nix optionsCtags -o opts-tags
(in vim): :set tags+=opts-tags
:tj boot.binfmt.emulatedSystems
```
This PR depends on and contains NixOS#249243. Marked as draft till that's
worked out. This PR pair replaces NixOS#208173.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
This is basically the change made by #65024
This branch is very WIP and I'm frankly not sure when I'll get back to it. For instance, I'm not sure where to put the script in the tree right now as it's late and I'm tired.
to use it:
then you can configure your editor, for instance with
'tags'in vim, to load tags from that file (as well as nix-doc generated nix function ctags!)output looks like this:
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes