summaryrefslogtreecommitdiff
path: root/lib/options.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib.options.mkPackageOption: use lib.showAttrPath•••Make use of `lib.showAttrPath` instead of manually doing `concatStringsSep "."`. This means edge-cases such as the attr-path including names that are not valid nix identifiers will be handled better. See: - https://nix.dev/manual/nix/2.26/language/identifiers - https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.attrsets.showAttrPath Matt Sturgeon2025-04-131-4/+6
* treewide: Format all Nix files•••Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting. Silvan Mosberger2025-04-011-176/+239
* Docs: migrate format of comments to doc-commentsJohannes Kirschbauer2025-02-121-41/+137
* doc: improve lib.options reference documentation (#316862)•••* Doc: lib/options fixup wording and references Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Silvan Mosberger <github@infinisil.com>Johannes Kirschbauer2025-01-131-116/+329
* treewide: Fix incorrect string escapespiegames2025-01-071-1/+1
* lib.types.attrsWith: add placeholder parameterJohannes Kirschbauer2024-12-091-11/+8
* lib/options: remove mdDoc•••Following through on message itself. Wolfgang Walther2024-11-221-7/+0
* lib: deprecate mkPackageOptionMDéclairevoyant2024-06-261-3/+3
* lib: clarify warning about mdDocéclairevoyant2024-04-151-1/+1
* lib.mdDoc: remove and replace with warningstuebinm2024-04-131-2/+4
* Merge pull request #284512 from hercules-ci/lib-types-unique-merge•••lib.types.unique: Check inner type deeplySilvan Mosberger2024-02-101-5/+23
|\
| * lib.option.mergeUniqueOption: Simplify and add warning about merge function•••The previous code was optimized for the old uniq behavior, which did not call merge. That's changed, so the legacy path is not a hot path anymore, and is not worth any tech debt. Robert Hensing2024-02-041-16/+11
| * lib.types.unique: Check inner type deeply•••This doesn't change uniq. Why not? - In NixOS it seems that uniq is only used with simple types that are fully checked by t.check. - It exists for much longer and is used more widely. - I believe we should deprecate it, because unique was already better. - unique can be a proving ground. Robert Hensing2024-01-281-5/+28
* | lib: make deprecation warnings consistent•••The deprecation warnings in lib were wildly inconsistent. Different formulations were used in different places for the same meaning. Some warnings used builtins.trace instead of lib.warn, which prevents silencing; one even only had a comment instead. Make everything more uniform. Alois Wohlschlager2024-02-031-1/+1
|/
* lib: Take advantage of section descriptions•••See https://github.com/nix-community/nixdoc/releases/tag/v2.6.0 Silvan Mosberger2023-11-201-1/+1
* lib/options: refactor mkPackageOptionAnselm Schüler2023-10-101-13/+13
* lib/options: add pkgsText parameter to mkPackageOptionAnselm Schüler2023-10-061-7/+22
* lib/options: correct and improve documentation of mkPackageOptionAnselm Schüler2023-10-061-13/+36
* lib: turn *MD functions into aliases•••with docbook gone and MD the default these aren't needed any more. we can't remove them yet because there's thousands of uses, but maybe some day we can. pennae2023-06-131-12/+7
* lib/options: remove literalDocBook•••no longer supported. warning when used would not be appropriate, and docbook has been on the way out for long enough that throwing an error should not be necessary either. pennae2023-06-131-13/+1
* lib/options: nullable mkPackageOption•••It is sometimes useful to allow setting a package option to `null` to skip installing the package. See https://github.com/nix-community/home-manager/pull/3668#issuecomment-1554044171 for example. Naïm Favier2023-05-191-7/+14
* lib/options: fix rendering of options with only a defaultText•••Some options have their default value set in the `config` instead of `default`, for example to push `mkDefault`s down an attribute set. In those cases, it's useful to provide a `defaultText` for informational purposes. Naïm Favier2023-05-061-3/+3
* lib/options: fix mkPackageOption docs•••nixdoc takes everything from Type: to Example: as the type, which misrendered a large part of the docs. it also drops sorely needed spaces where the type had line breaks, so all has to be on one line (or use non-standard literal spaces, which is probably worse). also clarify what the `?` for arguments mean while we're here. pennae2023-03-051-7/+5
* lib/options: Add more options to mkPackageOptionAnselm Schüler2023-02-261-15/+48
* lib/options: update showOption commentNaïm Favier2023-02-181-6/+4
* types: suggest how to resolve the conflictDomen Kožar2023-02-091-2/+5
* types: explicitly state unique options are expected to be uniqueDomen Kožar2023-02-091-1/+1
* lib: standardise attrset type syntax•••There are a number of different syntaxes used for attrset type signatures in our doc strings, this change standardises upon one that uses :: for specifying attribute type, and ; terminators to be consistent with nix syntax. There are no bugs in the functions themselves, just that different syntaxes may confuse new users. Colin Arnott2023-01-301-3/+3
* modules: add mkPackageOptionMD•••another transitional option factory, like mkAliasOptionModuleMD. pennae2023-01-051-1/+6
* attrsets: fix and add some doc typeshsjobeki2022-12-241-2/+2
* lib.modules: Add error context to rendered default and example attrsRobert Hensing2022-12-101-3/+14
* nixos/doc: render option values using `lib.generators.toPretty`•••Render un`_type`d defaults and examples as `literalExpression`s using `lib.generators.toPretty` so that consumers don't have to reinvent Nix pretty-printing. `renderOptionValue` is kept internal for now intentionally. Make `toPretty` print floats as valid Nix values (without a tilde). Get rid of the now-obsolete `substSpecial` function. Move towards disallowing evaluation of packages in the manual by raising a warning on `pkgs.foo.{outPath,drvPath}`; later, this should throw an error. Instead, module authors should use `literalExpression` and `mkPackageOption`. Naïm Favier2022-12-081-4/+17
* haskell.compiler.ghc92: 9.2.4 -> 9.2.5sternenseemann2022-11-071-1/+1
* 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. Maximilian Bosch2022-10-071-3/+9
* lib/options.nix: remove unused bindingfigsoda2022-09-261-1/+0
* lib/options: deprecate docbook text and literalDocBook•••deprecate literalDocBook by adding a warning (that will not fire yet) to its uses and other docbook literal strings by adding optional warning message to mergeJSON. pennae2022-09-101-1/+4
* lib/modules: convert option description to MDpennae2022-08-311-1/+1
* lib/options: add mdDoc support to mkEnableOptionpennae2022-08-301-1/+4
* haskell.compiler: ghc923 -> ghc924•••https://www.haskell.org/ghc/download_ghc_9_2_4.html sternenseemann2022-07-281-1/+1
* lib/options: Add hint for debugging infinite recursion in docsRobert Hensing2022-06-271-0/+2
* lib/options: Add showOptionWithDefLocsRobert Hensing2022-06-211-0/+6
* treewide: attempt at markdown option docspennae2022-06-121-0/+15
* haskell.compiler: ghc922 -> ghc923•••https://www.haskell.org/ghc/download_ghc_9_2_3.html Since the tarball is generated by Hadrian, neither autoreconf nor ./boot is executed so ./configure and ghc.mk is missing. sternenseemann2022-05-281-1/+1
* Merge remote-tracking branch 'origin/master' into haskell-updatessternenseemann2022-03-261-2/+0
|\
| * lib/modules: Finally remove deprecated types.optionSet•••types.optionSet has been deprecated for almost 10 years now (0e333688cea468a28516bf6935648c03ed62a7bb)! A removal was already attempted in 2019 (27982b408e465554b8831f492362bc87ed0ec02a), but it was promptly reinstantiated since some third-party uses were discovered (f531ce75e4178c6867cc1d0f7fec96b2d5c3f1cb). It's finally time to remove it for good :) Silvan Mosberger2022-03-181-2/+0
* | Merge master into haskell-updatesgithub-actions[bot]2022-03-171-1/+1
|\|
| * lib/options: Throw error for options without a type•••Makes all options rendered in the manual throw an error if they don't have a type specified. This is a follow-up to #76184 Co-Authored-By: Silvan Mosberger <contact@infinisil.com> Janne Heß2022-02-281-1/+1
* | haskell.compiler: ghc921 -> ghc922•••https://www.haskell.org/ghc/download_ghc_9_2_2.html sternenseemann2022-03-091-1/+1
|/
* Merge pull request #156503 from hercules-ci/nixos-add-system.build-options•••nixos: Add `system.build.`{`toplevel`,`installBootLoader`}, improve error messageRobert Hensing2022-01-251-5/+7
|\
| * lib.modules: Define mergeOneOption in terms of mergeUniqueOptionRobert Hensing2022-01-241-5/+1