nixpkgs/pkgs/by-name/vc/vcpkg-tool/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
1.9 KiB
Nix
Raw Normal View History

2023-10-10 20:10:23 +00:00
{ lib
, stdenv
, fetchFromGitHub
, cacert
, cmake
, cmakerc
, fmt
, git
, gzip
, meson
, ninja
, openssh
, python3
, zip
, zstd
, extraRuntimeDeps ? []
}:
stdenv.mkDerivation (finalAttrs: {
pname = "vcpkg-tool";
2024-06-13 03:02:28 +00:00
version = "2024-06-10";
2023-10-10 20:10:23 +00:00
src = fetchFromGitHub {
owner = "microsoft";
repo = "vcpkg-tool";
rev = finalAttrs.version;
2024-06-13 03:02:28 +00:00
hash = "sha256-TGRTzUd1FtErD+h/ksUsUm1Rhank9/yVy06JbAgEEw0=";
2023-10-10 20:10:23 +00:00
};
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
cmakerc
fmt
];
2023-10-10 20:10:23 +00:00
patches = [
./change-lock-location.patch
];
cmakeFlags = [
"-DVCPKG_DEPENDENCY_EXTERNAL_FMT=ON"
"-DVCPKG_DEPENDENCY_CMAKERC=ON"
];
# vcpkg needs two directories to write to that is independent of installation directory.
# Since vcpkg already creates $HOME/.vcpkg/ we use that to create a root where vcpkg can write into.
passAsFile = [ "vcpkgWrapper" ];
vcpkgWrapper = let
2023-10-10 20:10:23 +00:00
# These are the most common binaries used by vcpkg
# Extra binaries can be added via overlay when needed
runtimeDeps = [
cacert
cmake
git
gzip
meson
ninja
openssh
python3
zip
zstd
] ++ extraRuntimeDeps;
in ''
vcpkg_writable_path="$HOME/.vcpkg/root/"
export PATH="${lib.makeBinPath runtimeDeps}''${PATH:+":$PATH"}"
"${placeholder "out"}/bin/vcpkg" \
--x-downloads-root="$vcpkg_writable_path"/downloads \
--x-buildtrees-root="$vcpkg_writable_path"/buildtrees \
--x-packages-root="$vcpkg_writable_path"/packages \
"$@"
'';
postFixup = ''
mv "$out/bin/vcpkg" "$out/bin/.vcpkg-wrapped"
install -Dm555 "$vcpkgWrapperPath" "$out/bin/vcpkg"
2023-10-10 20:10:23 +00:00
'';
meta = {
description = "Components of microsoft/vcpkg's binary";
mainProgram = "vcpkg";
2023-10-10 20:10:23 +00:00
homepage = "https://github.com/microsoft/vcpkg-tool";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ guekka gracicot ];
platforms = lib.platforms.all;
};
})