Avoid top-level `with ...;` in pkgs/build-support/pkg-config-wrapper/default.nix

This commit is contained in:
Philip Taron 2024-03-14 09:59:39 -07:00 committed by Valentin Gagarin
parent 997e54a4fb
commit b7bcfbaeeb
1 changed files with 15 additions and 7 deletions

View File

@ -10,9 +10,17 @@
, extraPackages ? [], extraBuildCommands ? ""
}:
with lib;
let
inherit (lib)
attrByPath
getBin
optional
optionalAttrs
optionals
optionalString
replaceStrings
;
stdenv = stdenvNoCC;
inherit (stdenv) hostPlatform targetPlatform;
@ -20,7 +28,7 @@ let
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
targetPrefix = optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
# See description in cc-wrapper.
@ -49,7 +57,7 @@ stdenv.mkDerivation {
dontUnpack = true;
# Additional flags passed to pkg-config.
addFlags = lib.optional stdenv.targetPlatform.isStatic "--static";
addFlags = optional stdenv.targetPlatform.isStatic "--static";
installPhase =
''
@ -119,10 +127,10 @@ stdenv.mkDerivation {
};
meta =
let pkg-config_ = lib.optionalAttrs (pkg-config != null) pkg-config; in
(lib.optionalAttrs (pkg-config_ ? meta) (removeAttrs pkg-config.meta ["priority"])) //
let pkg-config_ = optionalAttrs (pkg-config != null) pkg-config; in
(optionalAttrs (pkg-config_ ? meta) (removeAttrs pkg-config.meta ["priority"])) //
{ description =
lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_
attrByPath ["meta" "description"] "pkg-config" pkg-config_
+ " (wrapper script)";
priority = 10;
};