1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
nixpkgs/lib/tests
Jade Lovelace a1d3882307 nixos/modules: Add declarationPositions
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:
- https://github.com/NixOS/nixpkgs/pull/65024

  This one does it for all *definitions* rather than declarations, and
  it was not followed through with due to performance worries.
- https://github.com/NixOS/nixpkgs/pull/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.
2023-09-08 11:48:40 +02:00
..
modules nixos/modules: Add declarationPositions 2023-09-08 11:48:40 +02:00
check-eval.nix
filesystem.sh lib/tests/filesystem.sh: Check success and failure separately 2023-06-01 18:07:33 +02:00
maintainer-module.nix maintainers: make email optional 2023-01-27 18:04:20 +01:00
maintainers.nix maintainers: clarify what fields are required 2023-01-27 18:05:28 +01:00
misc.nix Merge pull request #243520 from tweag/lib.lists.commonPrefix 2023-07-26 23:14:58 +02:00
modules.sh nixos/modules: Add declarationPositions 2023-09-08 11:48:40 +02:00
release.nix lib/tests: remove experimental-features 2023-06-27 11:48:53 +02:00
sources.sh lib/tests: Unify documentation of individual testable files 2023-07-18 17:22:45 +02:00
systems.nix lib.platforms.mips{,64}-embedded: init 2023-06-30 18:19:00 -07:00
teams.nix maintainer teams: check them in lib tests 2022-06-20 22:20:26 +02:00
test-to-plist-expected.plist lib.toPlist: keep test output in external files for their tab indents 2023-03-27 19:25:52 +02:00