Merge pull request #208674 from YoshiRulz/yoshi-lib-docs

lib: Fix mismatched quotes in `lib.*` doc comments

authored by Silvan Mosberger and committed by GitHub d35cae96 5e8b7993

+26 -26
+10 -10
lib/attrsets.nix
··· 88 else { ${elemAt attrPath n} = atDepth (n + 1); }; 89 in atDepth 0; 90 91 - /* Like `attrByPath', but without a default value. If it doesn't find the 92 path it will throw an error. 93 94 Example: ··· 274 # The set to get the named attributes from 275 attrs: genAttrs names (name: attrs.${name}); 276 277 - /* Collect each attribute named `attr' from a list of attribute 278 sets. Sets that don't contain the named attribute are ignored. 279 280 Example: ··· 357 ) {} list_of_attrs; 358 359 360 - /* Recursively collect sets that verify a given predicate named `pred' 361 - from the set `attrs'. The recursion is stopped when the predicate is 362 verified. 363 364 Example: ··· 439 listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))); 440 441 442 - /* Like `mapAttrs', but allows the name of each attribute to be 443 changed in addition to the value. The applied function should 444 - return both the new name and value as a `nameValuePair'. 445 446 Example: 447 mapAttrs' (name: value: nameValuePair ("foo_" + name) ("bar-" + value)) ··· 479 map (name: f name attrs.${name}) (attrNames attrs); 480 481 482 - /* Like `mapAttrs', except that it recursively applies itself to 483 attribute sets. Also, the first argument of the argument 484 function is a *list* of the names of the containing attributes. 485 ··· 499 mapAttrsRecursiveCond (as: true) f set; 500 501 502 - /* Like `mapAttrsRecursive', but it takes an additional predicate 503 function that tells it whether to recurse into an attribute 504 - set. If it returns false, `mapAttrsRecursiveCond' does not 505 recurse, but does apply the map function. If it returns true, it 506 does recurse, and does not apply the map function. 507 ··· 655 656 /* Merge sets of attributes and combine each attribute value in to a list. 657 658 - Like `lib.attrsets.zipAttrsWith' with `(name: values: values)' as the function. 659 660 Example: 661 zipAttrs [{a = "x";} {a = "y"; b = "z";}]
··· 88 else { ${elemAt attrPath n} = atDepth (n + 1); }; 89 in atDepth 0; 90 91 + /* Like `attrByPath`, but without a default value. If it doesn't find the 92 path it will throw an error. 93 94 Example: ··· 274 # The set to get the named attributes from 275 attrs: genAttrs names (name: attrs.${name}); 276 277 + /* Collect each attribute named `attr` from a list of attribute 278 sets. Sets that don't contain the named attribute are ignored. 279 280 Example: ··· 357 ) {} list_of_attrs; 358 359 360 + /* Recursively collect sets that verify a given predicate named `pred` 361 + from the set `attrs`. The recursion is stopped when the predicate is 362 verified. 363 364 Example: ··· 439 listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))); 440 441 442 + /* Like `mapAttrs`, but allows the name of each attribute to be 443 changed in addition to the value. The applied function should 444 + return both the new name and value as a `nameValuePair`. 445 446 Example: 447 mapAttrs' (name: value: nameValuePair ("foo_" + name) ("bar-" + value)) ··· 479 map (name: f name attrs.${name}) (attrNames attrs); 480 481 482 + /* Like `mapAttrs`, except that it recursively applies itself to 483 attribute sets. Also, the first argument of the argument 484 function is a *list* of the names of the containing attributes. 485 ··· 499 mapAttrsRecursiveCond (as: true) f set; 500 501 502 + /* Like `mapAttrsRecursive`, but it takes an additional predicate 503 function that tells it whether to recurse into an attribute 504 + set. If it returns false, `mapAttrsRecursiveCond` does not 505 recurse, but does apply the map function. If it returns true, it 506 does recurse, and does not apply the map function. 507 ··· 655 656 /* Merge sets of attributes and combine each attribute value in to a list. 657 658 + Like `lib.attrsets.zipAttrsWith` with `(name: values: values)` as the function. 659 660 Example: 661 zipAttrs [{a = "x";} {a = "y"; b = "z";}]
+11 -11
lib/customisation.nix
··· 3 rec { 4 5 6 - /* `overrideDerivation drv f' takes a derivation (i.e., the result 7 - of a call to the builtin function `derivation') and returns a new 8 derivation in which the attributes of the original are overridden 9 - according to the function `f'. The function `f' is called with 10 the original derivation attributes. 11 12 - `overrideDerivation' allows certain "ad-hoc" customisation 13 scenarios (e.g. in ~/.config/nixpkgs/config.nix). For instance, 14 if you want to "patch" the derivation returned by a package 15 function in Nixpkgs to build another version than what the ··· 104 else result; 105 106 107 - /* Call the package function in the file `fn' with the required 108 arguments automatically. The function is called with the 109 - arguments `args', but any missing arguments are obtained from 110 - `autoArgs'. This function is intended to be partially 111 parameterised, e.g., 112 113 callPackage = callPackageWith pkgs; ··· 116 libbar = callPackage ./bar.nix { }; 117 }; 118 119 - If the `libbar' function expects an argument named `libfoo', it is 120 automatically passed as an argument. Overrides or missing 121 - arguments can be supplied in `args', e.g. 122 123 libbar = callPackage ./bar.nix { 124 libfoo = null; ··· 255 in lib.deepSeq drv' drv'; 256 257 /* Make a set of packages with a common scope. All packages called 258 - with the provided `callPackage' will be evaluated with the same 259 arguments. Any package in the set may depend on any other. The 260 `overrideScope'` function allows subsequent modification of the package 261 set in a consistent way, i.e. all packages in the set will be 262 called with the overridden packages. The package sets may be 263 hierarchical: the packages in the set are called with the scope 264 - provided by `newScope' and the set provides a `newScope' attribute 265 which can form the parent scope for later package sets. */ 266 makeScope = newScope: f: 267 let self = f self // {
··· 3 rec { 4 5 6 + /* `overrideDerivation drv f` takes a derivation (i.e., the result 7 + of a call to the builtin function `derivation`) and returns a new 8 derivation in which the attributes of the original are overridden 9 + according to the function `f`. The function `f` is called with 10 the original derivation attributes. 11 12 + `overrideDerivation` allows certain "ad-hoc" customisation 13 scenarios (e.g. in ~/.config/nixpkgs/config.nix). For instance, 14 if you want to "patch" the derivation returned by a package 15 function in Nixpkgs to build another version than what the ··· 104 else result; 105 106 107 + /* Call the package function in the file `fn` with the required 108 arguments automatically. The function is called with the 109 + arguments `args`, but any missing arguments are obtained from 110 + `autoArgs`. This function is intended to be partially 111 parameterised, e.g., 112 113 callPackage = callPackageWith pkgs; ··· 116 libbar = callPackage ./bar.nix { }; 117 }; 118 119 + If the `libbar` function expects an argument named `libfoo`, it is 120 automatically passed as an argument. Overrides or missing 121 + arguments can be supplied in `args`, e.g. 122 123 libbar = callPackage ./bar.nix { 124 libfoo = null; ··· 255 in lib.deepSeq drv' drv'; 256 257 /* Make a set of packages with a common scope. All packages called 258 + with the provided `callPackage` will be evaluated with the same 259 arguments. Any package in the set may depend on any other. The 260 `overrideScope'` function allows subsequent modification of the package 261 set in a consistent way, i.e. all packages in the set will be 262 called with the overridden packages. The package sets may be 263 hierarchical: the packages in the set are called with the scope 264 + provided by `newScope` and the set provides a `newScope` attribute 265 which can form the parent scope for later package sets. */ 266 makeScope = newScope: f: 267 let self = f self // {
+1 -1
lib/default.nix
··· 1 /* Library of low-level helper functions for nix expressions. 2 * 3 * Please implement (mostly) exhaustive unit tests 4 - * for new functions in `./tests.nix'. 5 */ 6 let 7
··· 1 /* Library of low-level helper functions for nix expressions. 2 * 3 * Please implement (mostly) exhaustive unit tests 4 + * for new functions in `./tests.nix`. 5 */ 6 let 7
+3 -3
lib/lists.nix
··· 242 243 /* Return a singleton list or an empty list, depending on a boolean 244 value. Useful when building lists with optional elements 245 - (e.g. `++ optional (system == "i686-linux") firefox'). 246 247 Type: optional :: bool -> a -> [a] 248 ··· 283 */ 284 toList = x: if isList x then x else [x]; 285 286 - /* Return a list of integers from `first' up to and including `last'. 287 288 Type: range :: int -> int -> [int] 289 ··· 320 ) { right = []; wrong = []; }); 321 322 /* Splits the elements of a list into many lists, using the return value of a predicate. 323 - Predicate should return a string which becomes keys of attrset `groupBy' returns. 324 325 `groupBy'` allows to customise the combining function and initial value 326
··· 242 243 /* Return a singleton list or an empty list, depending on a boolean 244 value. Useful when building lists with optional elements 245 + (e.g. `++ optional (system == "i686-linux") firefox`). 246 247 Type: optional :: bool -> a -> [a] 248 ··· 283 */ 284 toList = x: if isList x then x else [x]; 285 286 + /* Return a list of integers from `first` up to and including `last`. 287 288 Type: range :: int -> int -> [int] 289 ··· 320 ) { right = []; wrong = []; }); 321 322 /* Splits the elements of a list into many lists, using the return value of a predicate. 323 + Predicate should return a string which becomes keys of attrset `groupBy` returns. 324 325 `groupBy'` allows to customise the combining function and initial value 326
+1 -1
lib/meta.nix
··· 27 setName = name: drv: drv // {inherit name;}; 28 29 30 - /* Like `setName', but takes the previous name as an argument. 31 32 Example: 33 updateName (oldName: oldName + "-experimental") somePkg
··· 27 setName = name: drv: drv // {inherit name;}; 28 29 30 + /* Like `setName`, but takes the previous name as an argument. 31 32 Example: 33 updateName (oldName: oldName + "-experimental") somePkg