1 /* Library of low-level helper functions for nix expressions.
3 * Please implement (mostly) exhaustive unit tests
4 * for new functions in `./tests.nix'.
8 inherit (import ./fixed-points.nix { inherit lib; }) makeExtensible;
10 lib = makeExtensible (self: let
11 callLibs = file: import file { lib = self; };
14 # often used, or depending on very little
15 trivial = callLibs ./trivial.nix;
16 fixedPoints = callLibs ./fixed-points.nix;
19 attrsets = callLibs ./attrsets.nix;
20 lists = callLibs ./lists.nix;
21 strings = callLibs ./strings.nix;
22 stringsWithDeps = callLibs ./strings-with-deps.nix;
25 customisation = callLibs ./customisation.nix;
26 derivations = callLibs ./derivations.nix;
27 maintainers = import ../maintainers/maintainer-list.nix;
28 teams = callLibs ../maintainers/team-list.nix;
29 meta = callLibs ./meta.nix;
30 sources = callLibs ./sources.nix;
31 versions = callLibs ./versions.nix;
34 modules = callLibs ./modules.nix;
35 options = callLibs ./options.nix;
36 types = callLibs ./types.nix;
39 licenses = callLibs ./licenses.nix;
40 sourceTypes = callLibs ./source-types.nix;
41 systems = callLibs ./systems;
44 cli = callLibs ./cli.nix;
45 generators = callLibs ./generators.nix;
48 asserts = callLibs ./asserts.nix;
49 debug = callLibs ./debug.nix;
50 misc = callLibs ./deprecated.nix;
53 fetchers = callLibs ./fetchers.nix;
55 # Eval-time filesystem handling
56 filesystem = callLibs ./filesystem.nix;
59 platforms = self.systems.doubles;
61 # linux kernel configuration
62 kernel = callLibs ./kernel.nix;
64 inherit (builtins) add addErrorContext attrNames concatLists
65 deepSeq elem elemAt filter genericClosure genList getAttr
66 hasAttr head isAttrs isBool isInt isList isString length
67 lessThan listToAttrs pathExists readFile replaceStrings seq
68 stringLength sub substring tail trace;
69 inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
70 bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
71 importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
72 info showWarnings nixpkgsVersion version isInOldestRelease
73 mod compare splitByAndCompare
74 functionArgs setFunctionArgs isFunction toFunction
75 toHexString toBaseDigits inPureEvalMode;
76 inherit (self.fixedPoints) fix fix' converge extends composeExtensions
77 composeManyExtensions makeExtensible makeExtensibleWithCustomName;
78 inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
79 getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs
80 filterAttrsRecursive foldAttrs collect nameValuePair mapAttrs
81 mapAttrs' mapAttrsToList mapAttrsRecursive mapAttrsRecursiveCond
82 genAttrs isDerivation toDerivation optionalAttrs
83 zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
84 recursiveUpdate matchAttrs overrideExisting showAttrPath getOutput getBin
85 getLib getDev getMan chooseDevOutputs zipWithNames zip
86 recurseIntoAttrs dontRecurseIntoAttrs cartesianProductOfSets
87 updateManyAttrsByPath;
88 inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
89 concatMap flatten remove findSingle findFirst any all count
90 optional optionals toList range partition zipListsWith zipLists
91 reverseList listDfs toposort sort naturalSort compareLists take
92 drop sublist last init crossLists unique intersectLists
93 subtractLists mutuallyExclusive groupBy groupBy';
94 inherit (self.strings) concatStrings concatMapStrings concatImapStrings
95 intersperse concatStringsSep concatMapStringsSep
96 concatImapStringsSep makeSearchPath makeSearchPathOutput
97 makeLibraryPath makeBinPath optionalString
98 hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
99 escapeShellArg escapeShellArgs isValidPosixName toShellVar toShellVars
100 escapeRegex escapeXML replaceChars lowerChars
101 upperChars toLower toUpper addContextFrom splitString
102 removePrefix removeSuffix versionOlder versionAtLeast
104 nameFromURL enableFeature enableFeatureAs withFeature
105 withFeatureAs fixedWidthString fixedWidthNumber isStorePath
106 toInt toIntBase10 readPathsFromFile fileContents;
107 inherit (self.stringsWithDeps) textClosureList textClosureMap
108 noDepEntry fullDepEntry packEntry stringAfter;
109 inherit (self.customisation) overrideDerivation makeOverridable
110 callPackageWith callPackagesWith extendDerivation hydraJob
111 makeScope makeScopeWithSplicing;
112 inherit (self.derivations) lazyDerivation;
113 inherit (self.meta) addMetaAttrs dontDistribute setName updateName
114 appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
115 hiPrioSet getLicenseFromSpdxId getExe;
116 inherit (self.sources) pathType pathIsDirectory cleanSourceFilter
117 cleanSource sourceByRegex sourceFilesBySuffices
118 commitIdFromGitRepo cleanSourceWith pathHasContext
119 canCleanSource pathIsRegularFile pathIsGitRepo;
120 inherit (self.modules) evalModules setDefaultModuleLocation
121 unifyModuleSyntax applyModuleArgsIfFunction mergeModules
122 mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
123 pushDownProperties dischargeProperties filterOverrides
124 sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride
125 mkOptionDefault mkDefault mkImageMediaOverride mkForce mkVMOverride
126 mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions
127 mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule
128 mkRenamedOptionModule mkRenamedOptionModuleWith
129 mkMergedOptionModule mkChangedOptionModule
130 mkAliasOptionModule mkDerivedConfig doRename;
131 inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
132 mergeDefaultOption mergeOneOption mergeEqualOption mergeUniqueOption
134 optionAttrSetToDocList optionAttrSetToDocList'
135 scrubOptionValue literalExpression literalExample literalDocBook
136 showOption showOptionWithDefLocs showFiles
137 unknownModule mkOption mkPackageOption
139 inherit (self.types) isType setType defaultTypeMerge defaultFunctor
140 isOptionType mkOptionType;
141 inherit (self.asserts)
142 assertMsg assertOneOf;
143 inherit (self.debug) addErrorContextToAttrs traceIf traceVal traceValFn
144 traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
145 traceValSeqFn traceValSeqN traceValSeqNFn traceFnSeqN traceShowVal
146 traceShowValMarked showVal traceCall traceCall2 traceCall3
147 traceValIfNot runTests testAllTrue traceCallXml attrNamesToStr;
148 inherit (self.misc) maybeEnv defaultMergeArg defaultMerge foldArgs
149 maybeAttrNullable maybeAttr ifEnable checkFlag getValue
150 checkReqs uniqList uniqListExt condConcat lazyGenericClosure
151 innerModifySumArgs modifySumArgs innerClosePropagation
152 closePropagation mapAttrsFlatten nvs setAttr setAttrMerge
153 mergeAttrsWithFunc mergeAttrsConcatenateValues
154 mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
155 mergeAttrsByFuncDefaultsClean mergeAttrBy
156 fakeHash fakeSha256 fakeSha512
158 inherit (self.versions)