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