Skip to content

Instantly share code, notes, and snippets.

@zopsicle
Last active December 8, 2019 16:09
Show Gist options
  • Save zopsicle/7ba22865dde3b176011314560dcd8941 to your computer and use it in GitHub Desktop.
Save zopsicle/7ba22865dde3b176011314560dcd8941 to your computer and use it in GitHub Desktop.
pkg-configWithPackages
{pkgs ? import ./nix/pkgs.nix {}}:
let
pkg-configWithPackages = packages: pkgs.stdenvNoCC.mkDerivation {
name = "pkg-configWithPackages";
buildInputs = [pkgs.makeWrapper];
phases = ["installPhase"];
installPhase = ''
makeWrapperFlags=()
for package in ${pkgs.lib.concatMapStringsSep " " (p: "${p}") packages}; do
makeWrapperFlags+=(--prefix PKG_CONFIG_PATH : $package/lib/pkgconfig)
done
mkdir --parents $out/bin
makeWrapper ${pkgs.pkg-config}/bin/pkg-config $out/bin/pkg-config \
"''${makeWrapperFlags[@]}"
'';
};
in
[
pkgs.bash
pkgs.coreutils
# etc
(
pkg-configWithPackages [
pkgs.zeromq4
]
)
]
nix run -ic pkg-config --libs libzmq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment