6 Commits

Author SHA1 Message Date
NAHO
c8d4dabc43 pkgs: 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 \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
Wolfgang Walther
2e43b87c62 replaceVars: fail when exemption can't be found
This also changes stdenv's substitute --replace-fail to error out when
the replacement is the same as the search pattern, but can't be found.
This should not cause any problems in existing code, from what I can
tell from grepping nixpkgs.

The exception for pattern==replacement was previously introduced all the
way back in 5ff872aa24, but this was
apparently only used to make the check for the warning "simpler".
2025-02-10 19:19:59 +01:00
Wolfgang Walther
321bd31b60 replaceVarsWith: fix checkPhase with dir set 2024-12-15 12:21:52 +01:00
Wolfgang Walther
4ce241c882 replaceVarsWith: init
Takes the extended features of nix substituteAll to a replaceVars
variant to get rid of those cases that use substituteAll to build a full
package with meta information etc.
2024-12-14 20:16:10 +01:00
Wolfgang Walther
2d64877f63 replaceVars: allow exemptions
replaceVars has a checkPhase to confirm that no left-over @...@ patterns
remain. Since it's not possible to use "placeholder" with replaceVars,
the substitution of some patterns must be delayed to a later step.

By passing "null" for those keys explicitly, replaceVars can make an
exemption *just for this case*, but keep checking all other references.
2024-11-24 17:08:06 +01:00
Philip Taron
b0b3172fb4 replaceVars: init 2024-08-07 07:27:50 -07:00