treewide: remove optional builtins prefixes from prelude functions

Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd --type file --exec-batch sed --in-place --regexp-extended "
      s/\<builtins\.($(
        printf '%s\n' "${builtins[@]}" |
          paste --delimiter '|' --serial -
      ))\>/\1/g
    "

    nix fmt
This commit is contained in:
NAHO
2025-09-30 08:50:13 +02:00
parent d17f0c1bf8
commit dec908b169
9 changed files with 22 additions and 22 deletions

View File

@@ -22,7 +22,7 @@ let
anyMatchingFiles = files: builtins.any anyMatchingFile files;
attrsWithMaintainers = lib.pipe (changedattrs ++ removedattrs) [
(builtins.map (
(map (
name:
let
# Some packages might be reported as changed on a different platform, but
@@ -46,7 +46,7 @@ let
relevantFilenames =
drv:
(lib.lists.unique (
builtins.map (pos: lib.strings.removePrefix (toString ../..) pos.file) (
map (pos: lib.strings.removePrefix (toString ../..) pos.file) (
builtins.filter (x: x != null) [
((drv.meta or { }).maintainersPosition or null)
((drv.meta or { }).teamsPosition or null)
@@ -73,7 +73,7 @@ let
)
));
attrsWithFilenames = builtins.map (
attrsWithFilenames = map (
pkg: pkg // { filenames = relevantFilenames pkg.package; }
) attrsWithMaintainers;
@@ -81,7 +81,7 @@ let
listToPing = lib.concatMap (
pkg:
builtins.map (maintainer: {
map (maintainer: {
id = maintainer.githubId;
inherit (maintainer) github;
packageName = pkg.name;
@@ -92,7 +92,7 @@ let
byMaintainer = lib.groupBy (ping: toString ping.${if byName then "github" else "id"}) listToPing;
packagesPerMaintainer = lib.attrsets.mapAttrs (
maintainer: packages: builtins.map (pkg: pkg.packageName) packages
maintainer: packages: map (pkg: pkg.packageName) packages
) byMaintainer;
in
packagesPerMaintainer

View File

@@ -66,7 +66,7 @@ rec {
*/
convertToPackagePlatformAttrs =
packagePlatformPaths:
builtins.filter (x: x != null) (builtins.map convertToPackagePlatformAttr packagePlatformPaths);
builtins.filter (x: x != null) (map convertToPackagePlatformAttr packagePlatformPaths);
/*
Converts a list of `packagePlatformPath`s directly to a list of (unique) package names
@@ -91,7 +91,7 @@ rec {
let
packagePlatformAttrs = convertToPackagePlatformAttrs (uniqueStrings packagePlatformPaths);
in
uniqueStrings (builtins.map (p: p.name) packagePlatformAttrs);
uniqueStrings (map (p: p.name) packagePlatformAttrs);
/*
Group a list of `packagePlatformAttr`s by platforms

View File

@@ -95,7 +95,7 @@ let
in
tweak (
(builtins.removeAttrs nixpkgsJobs blacklist)
(removeAttrs nixpkgsJobs blacklist)
// {
nixosTests.simple = nixosJobs.tests.simple;
}

View File

@@ -91,7 +91,7 @@
)
];
}
// builtins.removeAttrs args [ "modules" ]
// removeAttrs args [ "modules" ]
);
}
);

View File

@@ -8,7 +8,7 @@ rustPlatform.buildRustPackage {
filter =
name: type:
let
name' = builtins.baseNameOf name;
name' = baseNameOf name;
in
name' != "default.nix" && name' != "target";
};

View File

@@ -65,7 +65,7 @@ let
inherit (pkgs) lib;
# see usage explanation for the input format `files` allows
files' = builtins.map builtins.baseNameOf (if !builtins.isList files then [ files ] else files);
files' = map baseNameOf (if !builtins.isList files then [ files ] else files);
packageSetsWithVersionedHead =
pkgs.haskell.packages
@@ -99,7 +99,7 @@ let
# match the major and minor version of the GHC the config is intended for, if any
configVersion = lib.concatStrings (builtins.match "ghc-([0-9]+).([0-9]+).x" configName);
# return all package sets under haskell.packages matching the version components
setsForVersion = builtins.map (name: packageSetsWithVersionedHead.${name}) (
setsForVersion = map (name: packageSetsWithVersionedHead.${name}) (
builtins.filter (
setName:
lib.hasPrefix "ghc${configVersion}" setName && (skipBinaryGHCs -> !(lib.hasInfix "Binary" setName))
@@ -120,7 +120,7 @@ let
# attribute set that has all the attributes of haskellPackages set to null
availableHaskellPackages = builtins.listToAttrs (
builtins.map (attr: lib.nameValuePair attr null) (builtins.attrNames pkgs.haskellPackages)
map (attr: lib.nameValuePair attr null) (builtins.attrNames pkgs.haskellPackages)
);
# evaluate a configuration and only return the attributes changed by it,
@@ -155,7 +155,7 @@ let
sets = setsForFile fileName;
attrs = overriddenAttrs fileName;
in
lib.concatMap (set: builtins.map (attr: set.${attr}) attrs) sets
lib.concatMap (set: map (attr: set.${attr}) attrs) sets
) files'
);
in

View File

@@ -69,7 +69,7 @@ nixexpr() {
];
in
tweak (builtins.removeAttrs hydraJobs blacklist)
tweak (removeAttrs hydraJobs blacklist)
EONIX
}

View File

@@ -120,7 +120,7 @@ let
let
maintainer =
if !builtins.hasAttr maintainer' lib.maintainers then
builtins.throw "Maintainer with name `${maintainer'} does not exist in `maintainers/maintainer-list.nix`."
throw "Maintainer with name `${maintainer'} does not exist in `maintainers/maintainer-list.nix`."
else
builtins.getAttr maintainer' lib.maintainers;
in
@@ -147,7 +147,7 @@ let
pathContent = lib.attrByPath prefix null pkgs;
in
if pathContent == null then
builtins.throw "Attribute path `${path}` does not exist."
throw "Attribute path `${path}` does not exist."
else
packagesWithPath prefix (path: pkg: (get-script pkg != null)) pathContent;
@@ -158,9 +158,9 @@ let
package = lib.attrByPath (lib.splitString "." path) null pkgs;
in
if package == null then
builtins.throw "Package with an attribute name `${path}` does not exist."
throw "Package with an attribute name `${path}` does not exist."
else if get-script package == null then
builtins.throw "Package with an attribute name `${path}` does not have a `passthru.updateScript` attribute defined."
throw "Package with an attribute name `${path}` does not have a `passthru.updateScript` attribute defined."
else
{
attrPath = path;
@@ -178,7 +178,7 @@ let
else if path != null then
packagesWithUpdateScript path pkgs
else
builtins.throw "No arguments provided.\n\n${helpText}";
throw "No arguments provided.\n\n${helpText}";
helpText = ''
Please run:
@@ -242,7 +242,7 @@ let
name = package.name;
pname = lib.getName package;
oldVersion = lib.getVersion package;
updateScript = map builtins.toString (lib.toList (updateScript.command or updateScript));
updateScript = map toString (lib.toList (updateScript.command or updateScript));
supportedFeatures = updateScript.supportedFeatures or [ ];
attrPath = updateScript.attrPath or attrPath;
};

View File

@@ -19,7 +19,7 @@ let
inherit (import ./ci { inherit nixpkgs system; }) pkgs fmt;
# For `nix-shell -A hello`
curPkgs = builtins.removeAttrs (import ./. { inherit system; }) [
curPkgs = removeAttrs (import ./. { inherit system; }) [
# Although this is what anyone may expect from a `_type = "pkgs"`,
# this file is intended to produce a shell in the first place,
# and a `_type` tag could confuse some code.