nix-wine-experiments/pkgs/vcredist2019/default.nix
Gregory Bednov 04398840c0 новый файл: flake.lock
новый файл:    flake.nix
	новый файл:    pkgs/codesys2/default.nix
	новый файл:    pkgs/codesys2/setup.iss
	новый файл:    pkgs/codesys3/default.nix
	новый файл:    pkgs/mfc42/default.nix
	новый файл:    pkgs/mspaintxp/default.nix
	новый файл:    pkgs/vcredist2019/default.nix
2026-09-02 11:08:59 +03:00

35 lines
1.1 KiB
Nix

# Visual C++ 2019 (MSVC 14.29) x64 runtime DLLs.
# msvcp140.dll, vcruntime140.dll, concrt140.dll, mfc140.dll, and friends.
{
runCommand,
fetchurl,
cabextract,
p7zip,
}:
let
redist = fetchurl {
url = "https://aka.ms/vs/16/release/vc_redist.x64.exe";
hash = "sha256-avrming/ESkhSRdYRK7Q4s4/JHvAJQ9ssYyTEpWz85k=";
};
in
runCommand "vcredist2019"
{ nativeBuildInputs = [ cabextract p7zip ]; }
''
# The vcredist bundle is a WiX burn exe. Its structure:
# - PE stub (bootstrapper)
# - First CAB at offset 479744: bootstrapper UI resources
# - Second CAB at offset 684808: payload packages (MSIs + their CABs)
#
# We skip straight to the second CAB which contains the DLL payloads
# in its a11/a12/a13 inner CABs.
dd if=${redist} bs=1 skip=684808 of=container.cab 2>/dev/null
cabextract container.cab -d pkgs 2>/dev/null
mkdir -p $out/windll
# a11 = vcRuntimeMinimum_x64 payload, a12 = additional, a13 = MFC
for cab in pkgs/a11 pkgs/a12 pkgs/a13; do
[ -f "$cab" ] && cabextract "$cab" -F '*.dll' -d $out/windll 2>/dev/null || true
done
''