nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 19.09-beta 138 lines 6.3 kB view raw
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 */ 6let 7 8 inherit (import ./fixed-points.nix {}) makeExtensible; 9 10 lib = makeExtensible (self: let 11 callLibs = file: import file { lib = self; }; 12 in with self; { 13 14 # often used, or depending on very little 15 trivial = callLibs ./trivial.nix; 16 fixedPoints = callLibs ./fixed-points.nix; 17 18 # datatypes 19 attrsets = callLibs ./attrsets.nix; 20 lists = callLibs ./lists.nix; 21 strings = callLibs ./strings.nix; 22 stringsWithDeps = callLibs ./strings-with-deps.nix; 23 24 # packaging 25 customisation = callLibs ./customisation.nix; 26 maintainers = import ../maintainers/maintainer-list.nix; 27 meta = callLibs ./meta.nix; 28 sources = callLibs ./sources.nix; 29 versions = callLibs ./versions.nix; 30 31 # module system 32 modules = callLibs ./modules.nix; 33 options = callLibs ./options.nix; 34 types = callLibs ./types.nix; 35 36 # constants 37 licenses = callLibs ./licenses.nix; 38 systems = callLibs ./systems; 39 40 # misc 41 asserts = callLibs ./asserts.nix; 42 debug = callLibs ./debug.nix; 43 generators = callLibs ./generators.nix; 44 misc = callLibs ./deprecated.nix; 45 46 # domain-specific 47 fetchers = callLibs ./fetchers.nix; 48 49 # Eval-time filesystem handling 50 filesystem = callLibs ./filesystem.nix; 51 52 # back-compat aliases 53 platforms = systems.doubles; 54 55 inherit (builtins) add addErrorContext attrNames concatLists 56 deepSeq elem elemAt filter genericClosure genList getAttr 57 hasAttr head isAttrs isBool isInt isList isString length 58 lessThan listToAttrs pathExists readFile replaceStrings seq 59 stringLength sub substring tail; 60 inherit (trivial) id const concat or and bitAnd bitOr bitXor bitNot 61 boolToString mergeAttrs flip mapNullable inNixShell min max 62 importJSON warn info showWarnings nixpkgsVersion version mod compare 63 splitByAndCompare functionArgs setFunctionArgs isFunction; 64 inherit (fixedPoints) fix fix' converge extends composeExtensions 65 makeExtensible makeExtensibleWithCustomName; 66 inherit (attrsets) attrByPath hasAttrByPath setAttrByPath 67 getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs 68 filterAttrsRecursive foldAttrs collect nameValuePair mapAttrs 69 mapAttrs' mapAttrsToList mapAttrsRecursive mapAttrsRecursiveCond 70 genAttrs isDerivation toDerivation optionalAttrs 71 zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil 72 recursiveUpdate matchAttrs overrideExisting getOutput getBin 73 getLib getDev chooseDevOutputs zipWithNames zip; 74 inherit (lists) singleton forEach foldr fold foldl foldl' imap0 imap1 75 concatMap flatten remove findSingle findFirst any all count 76 optional optionals toList range partition zipListsWith zipLists 77 reverseList listDfs toposort sort naturalSort compareLists take 78 drop sublist last init crossLists unique intersectLists 79 subtractLists mutuallyExclusive groupBy groupBy'; 80 inherit (strings) concatStrings concatMapStrings concatImapStrings 81 intersperse concatStringsSep concatMapStringsSep 82 concatImapStringsSep makeSearchPath makeSearchPathOutput 83 makeLibraryPath makeBinPath optionalString 84 hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape 85 escapeShellArg escapeShellArgs replaceChars lowerChars 86 upperChars toLower toUpper addContextFrom splitString 87 removePrefix removeSuffix versionOlder versionAtLeast getVersion 88 nameFromURL enableFeature enableFeatureAs withFeature 89 withFeatureAs fixedWidthString fixedWidthNumber isStorePath 90 toInt readPathsFromFile fileContents; 91 inherit (stringsWithDeps) textClosureList textClosureMap 92 noDepEntry fullDepEntry packEntry stringAfter; 93 inherit (customisation) overrideDerivation makeOverridable 94 callPackageWith callPackagesWith extendDerivation hydraJob 95 makeScope; 96 inherit (meta) addMetaAttrs dontDistribute setName updateName 97 appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio 98 hiPrioSet; 99 inherit (sources) pathType pathIsDirectory cleanSourceFilter 100 cleanSource sourceByRegex sourceFilesBySuffices 101 commitIdFromGitRepo cleanSourceWith pathHasContext 102 canCleanSource; 103 inherit (modules) evalModules closeModules unifyModuleSyntax 104 applyIfFunction unpackSubmodule packSubmodule mergeModules 105 mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions 106 pushDownProperties dischargeProperties filterOverrides 107 sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride 108 mkOptionDefault mkDefault mkForce mkVMOverride mkStrict 109 mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions 110 mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule 111 mkRenamedOptionModule mkMergedOptionModule mkChangedOptionModule 112 mkAliasOptionModule doRename filterModules; 113 inherit (options) isOption mkEnableOption mkSinkUndeclaredOptions 114 mergeDefaultOption mergeOneOption mergeEqualOption getValues 115 getFiles optionAttrSetToDocList optionAttrSetToDocList' 116 scrubOptionValue literalExample showOption showFiles 117 unknownModule mkOption; 118 inherit (types) isType setType defaultTypeMerge defaultFunctor 119 isOptionType mkOptionType; 120 inherit (asserts) 121 assertMsg assertOneOf; 122 inherit (debug) addErrorContextToAttrs traceIf traceVal traceValFn 123 traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq 124 traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal 125 traceShowValMarked showVal traceCall traceCall2 traceCall3 126 traceValIfNot runTests testAllTrue traceCallXml attrNamesToStr; 127 inherit (misc) maybeEnv defaultMergeArg defaultMerge foldArgs 128 maybeAttrNullable maybeAttr ifEnable checkFlag getValue 129 checkReqs uniqList uniqListExt condConcat lazyGenericClosure 130 innerModifySumArgs modifySumArgs innerClosePropagation 131 closePropagation mapAttrsFlatten nvs setAttr setAttrMerge 132 mergeAttrsWithFunc mergeAttrsConcatenateValues 133 mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults 134 mergeAttrsByFuncDefaultsClean mergeAttrBy 135 fakeSha256 fakeSha512 136 nixType imap; 137 }); 138in lib