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

View File

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