nix.nvim/nix/cpptools.nix

72 lines
2.3 KiB
Nix

{
stdenv,
lib,
system ? builtins.currentSystem,
fetchurl,
unzip,
libz,
libcxx,
lttng-ust_2_12,
autoPatchelfHook,
}:
stdenv.mkDerivation rec {
pname = "cpptools";
version = "1.21.6";
# Get the current system architecture
# arch = builtins.currentSystem;
linux-x64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-x64.vsix";
linux-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-arm64.vsix";
darwin-x64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-x64.vsix";
darwin-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-arm64.vsix";
src = fetchurl {
url = lib.getAttr system {
x86_64-linux = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-x64.vsix";
aarch64-linux = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-arm64.vsix";
aarch64-darwin = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-arm64.vsix";
x86_64-darwin = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-x64.vsix";
};
hash = lib.getAttr system {
x86_64-linux = "sha256-q6SDImUppICJopOi+HiIUMg7Ue1Qu0A41uewNxRdzeA=";
aarch64-linux = "sha256-/Zci8P5RAK26FASHpQnIYR5fvSF9lgTTrgVAT33Wfwc=";
x86_64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ=";
aarch64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ=";
};
};
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
unzip
libz
libcxx
lttng-ust_2_12
];
unpackPhase = ''
unzip $src
'';
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/opt
cp -r extension/debugAdapters/* $out/opt
install -m755 -D extension/debugAdapters/bin/OpenDebugAD7 $out/opt/bin/OpenDebugAD7
ln -s $out/opt/bin/OpenDebugAD7 $out/bin/OpenDebugAD7
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/microsoft/vscode-cpptools";
description = "Official repository for the Microsoft C/C++ extension for VS Code. ";
platforms = platforms.linux;
};
}