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