simplify top of lib

This commit is contained in:
Jeff Hykin 2024-05-26 10:05:03 -04:00
parent 590b181303
commit 63c79d1b48

View file

@ -28,149 +28,128 @@ in
# #
# legacy lib # legacy lib
# #
lib = fixedPoints.makeExtensible (self: let lib = fixedPoints.makeExtensible (
callLibs = file: import file { lib = self; }; self:
in untangledBase // { untangledBase // {
fixedPoints = fixedPoints; trivial = import ./source/trivial.nix { lib = self; };
# often used, or depending on very little attrsets = import ./source/attrsets.nix { lib = self; };
trivial = callLibs ./source/trivial.nix; lists = import ./source/lists.nix { lib = self; };
strings = import ./source/strings.nix { lib = self; };
stringsWithDeps = import ./source/strings-with-deps.nix { lib = self; };
customisation = import ./source/customisation.nix { lib = self; };
derivations = import ./source/derivations.nix { lib = self; };
meta = import ./source/meta.nix { lib = self; };
versions = import ./source/versions.nix { lib = self; };
modules = import ./source/modules.nix { lib = self; };
options = import ./source/options.nix { lib = self; };
types = import ./source/types.nix { lib = self; };
systems = import ./source/systems { lib = self; };
cli = import ./source/cli.nix { lib = self; };
gvariant = import ./source/gvariant.nix { lib = self; };
generators = import ./source/generators.nix { lib = self; };
asserts = import ./source/asserts.nix { lib = self; };
debug = import ./source/debug.nix { lib = self; };
fetchers = import ./source/fetchers.nix { lib = self; };
path = import ./source/path { lib = self; };
filesystem = import ./source/filesystem.nix { lib = self; };
fileset = import ./source/fileset { lib = self; };
sources = import ./source/sources.nix { lib = self; };
kernel = import ./source/kernel.nix { lib = self; };
# datatypes platforms = self.systems.doubles; # back-compat aliases # TODO: these are not the same as system.platform, we should probably try and unify them
attrsets = callLibs ./source/attrsets.nix;
lists = callLibs ./source/lists.nix;
strings = callLibs ./source/strings.nix;
stringsWithDeps = callLibs ./source/strings-with-deps.nix;
# packaging inherit (builtins) add addErrorContext attrNames concatLists
customisation = callLibs ./source/customisation.nix; deepSeq elem elemAt filter genericClosure genList getAttr
derivations = callLibs ./source/derivations.nix; hasAttr head isAttrs isBool isInt isList isPath isString length
meta = callLibs ./source/meta.nix; lessThan listToAttrs pathExists readFile replaceStrings seq
versions = callLibs ./source/versions.nix; stringLength sub substring tail trace;
inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor
# module system bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
modules = callLibs ./source/modules.nix; importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
options = callLibs ./source/options.nix; info showWarnings nixpkgsVersion version isInOldestRelease
types = callLibs ./source/types.nix; mod compare splitByAndCompare
functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs
# constants toHexString toBaseDigits inPureEvalMode;
systems = callLibs ./source/systems; inherit (self.fixedPoints) fix fix' converge extends composeExtensions
composeManyExtensions makeExtensible makeExtensibleWithCustomName;
# serialization inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
cli = callLibs ./source/cli.nix; getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs
gvariant = callLibs ./source/gvariant.nix; filterAttrsRecursive foldlAttrs foldAttrs collect nameValuePair mapAttrs
generators = callLibs ./source/generators.nix; mapAttrs' mapAttrsToList attrsToList concatMapAttrs mapAttrsRecursive
mapAttrsRecursiveCond genAttrs isDerivation toDerivation optionalAttrs
# misc zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
asserts = callLibs ./source/asserts.nix; recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput
debug = callLibs ./source/debug.nix; getBin getLib getDev getMan chooseDevOutputs zipWithNames zip
recurseIntoAttrs dontRecurseIntoAttrs cartesianProduct cartesianProductOfSets
# domain-specific mapCartesianProduct updateManyAttrsByPath;
fetchers = callLibs ./source/fetchers.nix; inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
ifilter0 concatMap flatten remove findSingle findFirst any all count
# Eval-time filesystem handling optional optionals toList range replicate partition zipListsWith zipLists
path = callLibs ./source/path; reverseList listDfs toposort sort sortOn naturalSort compareLists take
filesystem = callLibs ./source/filesystem.nix; drop sublist last init crossLists unique allUnique intersectLists
fileset = callLibs ./source/fileset; subtractLists mutuallyExclusive groupBy groupBy';
sources = callLibs ./source/sources.nix; inherit (self.strings) concatStrings concatMapStrings concatImapStrings
intersperse concatStringsSep concatMapStringsSep
# TODO: these are not the same as system.platform, we should probably try and unify them concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput
# back-compat aliases makeLibraryPath makeIncludePath makeBinPath optionalString
platforms = self.systems.doubles; hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
escapeShellArg escapeShellArgs
# linux kernel configuration isStorePath isStringLike
kernel = callLibs ./source/kernel.nix; isValidPosixName toShellVar toShellVars
escapeRegex escapeURL escapeXML replaceChars lowerChars
inherit (builtins) add addErrorContext attrNames concatLists upperChars toLower toUpper addContextFrom splitString
deepSeq elem elemAt filter genericClosure genList getAttr removePrefix removeSuffix versionOlder versionAtLeast
hasAttr head isAttrs isBool isInt isList isPath isString length getName getVersion
lessThan listToAttrs pathExists readFile replaceStrings seq cmakeOptionType cmakeBool cmakeFeature
stringLength sub substring tail trace; mesonOption mesonBool mesonEnable
inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor nameFromURL enableFeature enableFeatureAs withFeature
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max withFeatureAs fixedWidthString fixedWidthNumber
importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum toInt toIntBase10 readPathsFromFile fileContents;
info showWarnings nixpkgsVersion version isInOldestRelease inherit (self.stringsWithDeps) textClosureList textClosureMap
mod compare splitByAndCompare noDepEntry fullDepEntry packEntry stringAfter;
functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs inherit (self.customisation) overrideDerivation makeOverridable
toHexString toBaseDigits inPureEvalMode; callPackageWith callPackagesWith extendDerivation hydraJob
inherit (self.fixedPoints) fix fix' converge extends composeExtensions makeScope makeScopeWithSplicing makeScopeWithSplicing';
composeManyExtensions makeExtensible makeExtensibleWithCustomName; inherit (self.derivations) lazyDerivation optionalDrvAttr;
inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath inherit (self.meta) addMetaAttrs dontDistribute setName updateName
getAttrFromPath attrVals attrValues getAttrs catAttrs filterAttrs appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
filterAttrsRecursive foldlAttrs foldAttrs collect nameValuePair mapAttrs hiPrioSet getLicenseFromSpdxId getExe getExe';
mapAttrs' mapAttrsToList attrsToList concatMapAttrs mapAttrsRecursive inherit (self.filesystem) pathType pathIsDirectory pathIsRegularFile
mapAttrsRecursiveCond genAttrs isDerivation toDerivation optionalAttrs packagesFromDirectoryRecursive;
zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil inherit (self.sources) cleanSourceFilter
recursiveUpdate matchAttrs mergeAttrsList overrideExisting showAttrPath getOutput cleanSource sourceByRegex sourceFilesBySuffices
getBin getLib getDev getMan chooseDevOutputs zipWithNames zip commitIdFromGitRepo cleanSourceWith pathHasContext
recurseIntoAttrs dontRecurseIntoAttrs cartesianProduct cartesianProductOfSets canCleanSource pathIsGitRepo;
mapCartesianProduct updateManyAttrsByPath; inherit (self.modules) evalModules setDefaultModuleLocation
inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1 unifyModuleSyntax applyModuleArgsIfFunction mergeModules
ifilter0 concatMap flatten remove findSingle findFirst any all count mergeModules' mergeOptionDecls mergeDefinitions
optional optionals toList range replicate partition zipListsWith zipLists pushDownProperties dischargeProperties filterOverrides
reverseList listDfs toposort sort sortOn naturalSort compareLists take sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride
drop sublist last init crossLists unique allUnique intersectLists mkOptionDefault mkDefault mkImageMediaOverride mkForce mkVMOverride
subtractLists mutuallyExclusive groupBy groupBy'; mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions
inherit (self.strings) concatStrings concatMapStrings concatImapStrings mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule
intersperse concatStringsSep concatMapStringsSep mkRenamedOptionModule mkRenamedOptionModuleWith
concatImapStringsSep concatLines makeSearchPath makeSearchPathOutput mkMergedOptionModule mkChangedOptionModule
makeLibraryPath makeIncludePath makeBinPath optionalString mkAliasOptionModule mkDerivedConfig doRename
hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape mkAliasOptionModuleMD;
escapeShellArg escapeShellArgs inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
isStorePath isStringLike mergeDefaultOption mergeOneOption mergeEqualOption mergeUniqueOption
isValidPosixName toShellVar toShellVars getValues getFiles
escapeRegex escapeURL escapeXML replaceChars lowerChars optionAttrSetToDocList optionAttrSetToDocList'
upperChars toLower toUpper addContextFrom splitString scrubOptionValue literalExpression literalExample
removePrefix removeSuffix versionOlder versionAtLeast showOption showOptionWithDefLocs showFiles
getName getVersion unknownModule mkOption mkPackageOption mkPackageOptionMD
cmakeOptionType cmakeBool cmakeFeature mdDoc literalMD;
mesonOption mesonBool mesonEnable inherit (self.types) isType setType defaultTypeMerge defaultFunctor
nameFromURL enableFeature enableFeatureAs withFeature isOptionType mkOptionType;
withFeatureAs fixedWidthString fixedWidthNumber inherit (self.asserts)
toInt toIntBase10 readPathsFromFile fileContents; assertMsg assertOneOf;
inherit (self.stringsWithDeps) textClosureList textClosureMap inherit (self.debug) traceIf traceVal traceValFn
noDepEntry fullDepEntry packEntry stringAfter; traceSeq traceSeqN traceValSeq
inherit (self.customisation) overrideDerivation makeOverridable traceValSeqFn traceValSeqN traceValSeqNFn traceFnSeqN
callPackageWith callPackagesWith extendDerivation hydraJob runTests testAllTrue;
makeScope makeScopeWithSplicing makeScopeWithSplicing'; inherit (self.versions)
inherit (self.derivations) lazyDerivation optionalDrvAttr; splitVersion;
inherit (self.meta) addMetaAttrs dontDistribute setName updateName }
appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio );
hiPrioSet getLicenseFromSpdxId getExe getExe';
inherit (self.filesystem) pathType pathIsDirectory pathIsRegularFile
packagesFromDirectoryRecursive;
inherit (self.sources) cleanSourceFilter
cleanSource sourceByRegex sourceFilesBySuffices
commitIdFromGitRepo cleanSourceWith pathHasContext
canCleanSource pathIsGitRepo;
inherit (self.modules) evalModules setDefaultModuleLocation
unifyModuleSyntax applyModuleArgsIfFunction mergeModules
mergeModules' mergeOptionDecls mergeDefinitions
pushDownProperties dischargeProperties filterOverrides
sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride
mkOptionDefault mkDefault mkImageMediaOverride mkForce mkVMOverride
mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions
mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule
mkRenamedOptionModule mkRenamedOptionModuleWith
mkMergedOptionModule mkChangedOptionModule
mkAliasOptionModule mkDerivedConfig doRename
mkAliasOptionModuleMD;
inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
mergeDefaultOption mergeOneOption mergeEqualOption mergeUniqueOption
getValues getFiles
optionAttrSetToDocList optionAttrSetToDocList'
scrubOptionValue literalExpression literalExample
showOption showOptionWithDefLocs showFiles
unknownModule mkOption mkPackageOption mkPackageOptionMD
mdDoc literalMD;
inherit (self.types) isType setType defaultTypeMerge defaultFunctor
isOptionType mkOptionType;
inherit (self.asserts)
assertMsg assertOneOf;
inherit (self.debug) traceIf traceVal traceValFn
traceSeq traceSeqN traceValSeq
traceValSeqFn traceValSeqN traceValSeqNFn traceFnSeqN
runTests testAllTrue;
inherit (self.versions)
splitVersion;
});
in lib in lib