1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

lib.getAttrFromPath: fix docs (#400948)

This commit is contained in:
Johannes Kirschbauer 2025-04-23 14:09:23 +02:00 committed by GitHub
commit bda0c8532b
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -301,9 +301,9 @@ rec {
Nix has an [attribute selection operator](https://nixos.org/manual/nix/stable/language/operators#attribute-selection) which is sufficient for such queries, as long as the number of attributes is static. For example:
```nix
x.a.b == getAttrByPath ["a" "b"] x
x.a.b == getAttrFromPath ["a" "b"] x
# and
x.${f p}."example.com" == getAttrByPath [ (f p) "example.com" ] x
x.${f p}."example.com" == getAttrFromPath [ (f p) "example.com" ] x
```
# Inputs