nixpkgs/lib
Maximilian Bosch 6396482dde
lib/options/showOption: fix quoting of attr-names that are not identifiers
Personally, I think that warnings such as

    warning: The option `services.redis.enable' defined in `/home/ma27/Projects/nixpkgs/test.nix@node-vm' has been renamed to `services.redis.servers..enable'.

are fairly confusing because of the `..` and it's more correct to
actually quote that. With this change the warning now looks like this:

    warning: The option `services.redis.enable' defined in `/home/ma27/Projects/nixpkgs/test.nix@node-vm' has been renamed to `services.redis.servers."".enable'.

While implementing that I realized that you'd have
a similar problem whenever you use attribute-names that aren't
identifiers, e.g.

    services.nginx.virtualHosts."example.org".locations."/".invalid = 23;

now results in the following error:

    error: The option `interactive.nodes.vm.services.nginx.virtualHosts."example.org".locations."/".invalid' does not exist. Definition values:
           - In `/home/ma27/Projects/nixpkgs/test.nix@node-vm': 23

Of course there are some corner-cases where this won't work: when
generating the manual, you display submodules like this:

    services.nginx.virtualHosts.<name>

Since `<name>` isn't a value, but an indicator for a submodule, it must
not be quoted. This also applies to the following identifiers:

* `*` for `listOf submodule`
* `<function body>` for `functionTo`

This might not be correct if you actually have a submodule with an
attribute name called `<name>`, but I think it's an improvement over the
current situation and for this you'd probably need to make even more
complex changes to the module system.
2022-10-07 10:09:03 +02:00
..
systems lib/systems/default.nix: add efiArch suffixes 2022-09-29 08:02:35 +00:00
tests lib/types: always use <function body> instead of [function body] to indicate a function inside an option structure 2022-10-07 10:01:44 +02:00
asserts.nix lib/asserts: use throw to display message for assertMsg 2022-01-19 00:50:06 +01:00
attrsets.nix lib.foldAttrs: Clarify example 2022-05-10 07:01:00 +02:00
cli.nix
customisation.nix lib/customization: Improve callPackage error message for missing args 2022-04-01 22:03:05 +02:00
debug.nix
default.nix lib: Add lazyDerivation 2022-09-21 10:55:07 +01:00
deprecated.nix
derivations.nix lib: Add lazyDerivation 2022-09-21 10:55:07 +01:00
fetchers.nix
filesystem.nix
fixed-points.nix
flake.nix
generators.nix lib.generators: simplify toYAML 2022-09-28 16:34:55 -04:00
kernel.nix
licenses.nix licenses: add BOLA license 2022-09-28 15:35:51 +02:00
lists.nix Fix a typo in the lib.foldr docstring 2022-08-20 23:58:57 +01:00
meta.nix lib/meta: add getExe to get the main program of a drv 2022-04-24 04:19:49 +03:00
minver.nix boostrap fetchurl: Add SRI support 2022-08-24 09:55:45 +02:00
modules.nix Merge pull request #193132 from figsoda/clean-up 2022-10-01 17:03:11 -04:00
options.nix lib/options/showOption: fix quoting of attr-names that are not identifiers 2022-10-07 10:09:03 +02:00
source-types.nix lib.sourceTypes: simplify implementation 2022-05-30 16:27:34 +08:00
sources.nix lib/sources.nix: remove unused binding 2022-09-26 22:18:55 -04:00
strings-with-deps.nix
strings.nix lib/strings/toShellVars: handle derivations as strings 2022-05-07 17:01:51 +02:00
trivial.nix lib/trivial: Update oldestSupportedRelease 2022-07-04 20:07:44 +02:00
types.nix lib/types: always use <function body> instead of [function body] to indicate a function inside an option structure 2022-10-07 10:01:44 +02:00
versions.nix
zip-int-bits.nix lib/zip-int-bits: fix typo: bitXOR -> bitXor 2022-06-09 20:04:37 +03:00