summary refs log tree commit diff
path: root/lib/options.nix
Commit message (Collapse)AuthorAge
* Revert "nixos: doc: implement related packages in the manual"Graham Christensen2017-12-23
|
* nixos, lib: implement relatedPackages optionJan Malakhovski2017-12-07
| | | | | | This allows one to specify "related packages" in NixOS that get rendered into the configuration.nix(5) man page. The interface philosophy is pretty much stolen from TeX bibliography.
* Convert libs to a fixed-pointGraham Christensen2017-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does break the API of being able to import any lib file and get its libs, however I'm not sure people did this. I made this while exploring being able to swap out docFn with a stub in #2305, to avoid functor performance problems. I don't know if that is going to move forward (or if it is a problem or not,) but after doing all this work figured I'd put it up anyway :) Two notable advantages to this approach: 1. when a lib inherits another lib's functions, it doesn't automatically get put in to the scope of lib 2. when a lib implements a new obscure functions, it doesn't automatically get put in to the scope of lib Using the test script (later in this commit) I got the following diff on the API: + diff master fixed-lib 11764a11765,11766 > .types.defaultFunctor > .types.defaultTypeMerge 11774a11777,11778 > .types.isOptionType > .types.isType 11781a11786 > .types.mkOptionType 11788a11794 > .types.setType 11795a11802 > .types.types This means that this commit _adds_ to the API, however I can't find a way to fix these last remaining discrepancies. At least none are _removed_. Test script (run with nix-repl in the PATH): #!/bin/sh set -eux repl() { suff=${1:-} echo "(import ./lib)$suff" \ | nix-repl 2>&1 } attrs_to_check() { repl "${1:-}" \ | tr ';' $'\n' \ | grep "\.\.\." \ | cut -d' ' -f2 \ | sed -e "s/^/${1:-}./" \ | sort } summ() { repl "${1:-}" \ | tr ' ' $'\n' \ | sort \ | uniq } deep_summ() { suff="${1:-}" depth="${2:-4}" depth=$((depth - 1)) summ "$suff" for attr in $(attrs_to_check "$suff" | grep -v "types.types"); do if [ $depth -eq 0 ]; then summ "$attr" | sed -e "s/^/$attr./" else deep_summ "$attr" "$depth" | sed -e "s/^/$attr./" fi done } ( cd nixpkgs #git add . #git commit -m "Auto-commit, sorry" || true git checkout fixed-lib deep_summ > ../fixed-lib git checkout master deep_summ > ../master ) if diff master fixed-lib; then echo "SHALLOW MATCH!" fi ( cd nixpkgs git checkout fixed-lib repl .types )
* module system: extensible option typesEric Sagnes2016-11-06
|
* Add read-only optionsEelco Dolstra2015-07-30
| | | | | These are options that can have only one definition, regardless of priority.
* Rename misc.nix -> deprecated.nixEelco Dolstra2015-07-23
|
* Use foldl' instead of fold in some placesEelco Dolstra2015-07-23
|
* optionAttrSetToDocList: O(n^2) -> O(n)Eelco Dolstra2015-07-23
| | | | This shaves about 10% off memory consumption of NixOS evaluation.
* Make types.bool complain on conflicting definitionsEelco Dolstra2015-06-15
| | | | | | | Previously, conflicting definitions would merge to "true". Now they give an error, e.g. error: The option `hardware.enableAllFirmware' has conflicting definitions, in `/etc/nixos/configurations/misc/eelco/stuff.nix' and `/etc/nixos/configurations/misc/eelco/mandark.nix'.
* Remove obsolete stuffEelco Dolstra2015-06-15
|
* Add Type information into manual and manpages, fixes #4600Domen Kožar2015-01-04
|
* modules: Add mkSinkUndeclaredOptions.Nicolas B. Pierron2014-12-21
|
* Eliminate some optionals/optionalAttrs calls on the hot pathEelco Dolstra2014-10-05
|
* Add some primops to libEelco Dolstra2013-11-12
|
* Clean up some option examplesEelco Dolstra2013-10-30
|
* Strictly check the arguments to mkOptionEelco Dolstra2013-10-30
| | | | And fix various instances of bad arguments.
* Show correct position info for errors in submodulesEelco Dolstra2013-10-30
| | | | | | | | E.g. The unique option `fileSystems./.device' is defined multiple times, in `/etc/nixos/configuration.nix' and `/etc/nixos/foo.nix'. This requires passing file/value tuples to the merge functions.
* Remove obsolete function addDefaultOptionValuesEelco Dolstra2013-10-28
|
* Show precise error messages in option merge failuresEelco Dolstra2013-10-28
| | | | | | | | | | | | | | For instance, if time.timeZone is defined multiple times, you now get the error message: error: user-thrown exception: The unique option `time.timeZone' is defined multiple times, in `/etc/nixos/configurations/misc/eelco/x11vnc.nix' and `/etc/nixos/configuration.nix'. while previously you got: error: user-thrown exception: Multiple definitions of string. Only one is allowed for this option. and only an inspection of the stack trace gave a clue as to what option caused the problem.
* Remove uses of the "merge" option attributeEelco Dolstra2013-10-28
| | | | | It's redundant because you can (and should) specify an option type, or an apply function.
* Fix manual generationEelco Dolstra2013-10-28
|
* Remove dead codeEelco Dolstra2013-10-28
|
* Remove uses of mkFixStrictnessEelco Dolstra2013-10-28
| | | | mkFixStrictness is no longer needed, woohoo!
* Big cleanup of the NixOS module systemEelco Dolstra2013-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The major changes are: * The evaluation is now driven by the declared options. In particular, this fixes the long-standing problem with lack of laziness of disabled option definitions. Thus, a configuration like config = mkIf false { environment.systemPackages = throw "bla"; }; will now evaluate without throwing an error. This also improves performance since we're not evaluating unused option definitions. * The implementation of properties is greatly simplified. * There is a new type constructor "submodule" that replaces "optionSet". Unlike "optionSet", "submodule" gets its option declarations as an argument, making it more like "listOf" and other type constructors. A typical use is: foo = mkOption { type = type.attrsOf (type.submodule ( { config, ... }: { bar = mkOption { ... }; xyzzy = mkOption { ... }; })); }; Existing uses of "optionSet" are automatically mapped to "submodule". * Modules are now checked for unsupported attributes: you get an error if a module contains an attribute other than "config", "options" or "imports". * The new implementation is faster and uses much less memory.
* Slightly improve option type error messagesEelco Dolstra2013-10-23
|
* Manual: Don't show obsolete/deprecated optionsEelco Dolstra2013-10-23
|
* Allow options to be marked as "internal"Eelco Dolstra2013-10-23
| | | | | This means they're not for end users. Currently they're filtered from the manual, but we could include them in a separate section.
* mkEnableOption: Add a period at the end of the descriptionEelco Dolstra2013-10-17
|
* Rename newOptionAttrSetToDocList -> optionAttrSetToDocListEelco Dolstra2013-10-17
|
* Move pkgs/lib/ to lib/Eelco Dolstra2013-10-10