1
0
Fork 0

wfvm: new visual studio installation technique

This commit is contained in:
Sebastien Bourdeauducq 2020-06-18 01:58:09 +08:00
parent 1bf63a88ad
commit 08d28437e4
1 changed files with 34 additions and 20 deletions

View File

@ -1,4 +1,7 @@
{ pkgs }: { pkgs }:
let
wfvm = import ./.. { inherit pkgs; };
in
{ {
anaconda3 = { anaconda3 = {
name = "Anaconda3"; name = "Anaconda3";
@ -78,38 +81,49 @@
''; '';
}; };
msvc = { msvc = {
# https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2019
name = "MSVC"; name = "MSVC";
script = let script = let
msvc-wine = pkgs.fetchFromGitHub { bootstrapper = pkgs.fetchurl {
owner = "mstorsjo"; url = "https://download.visualstudio.microsoft.com/download/pr/df6c2f11-eae3-4d3c-a0a8-9aec3421235b/313d838f54928b8e7138d6efc8387e5dfbcc0271f326bf0f60b9aaf57073cff5/vs_Community.exe";
repo = "msvc-wine"; sha256 = "1xfgfdqgbamrc07vy9pkf41crysxgqwcivyn71qqx2wjaj7q6g9i";
rev = "b953f996401c19df3039c04e4ac7f962e435a4b2";
sha256 = "12rqx0r3d836x4k1ccda5xmzsd2938v5gmrp27awmzv1j3wplfsq";
}; };
vs = pkgs.stdenv.mkDerivation { # This touchy-feely "community" piece of trash seems deliberately crafted to break Wine, so we use the VM to run it.
download-vs = wfvm.utils.wfvm-run {
name = "download-vs";
image = wfvm.makeWindowsImage { };
isolateNetwork = false;
script =
''
ln -s ${bootstrapper} vs_Community.exe
${wfvm.utils.win-put}/bin/win-put vs_Community.exe
rm vs_Community.exe
${wfvm.utils.win-exec}/bin/win-exec "vs_Community.exe --quiet --layout vslayout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US"
${wfvm.utils.win-get}/bin/win-get vslayout
'';
};
cache = pkgs.stdenv.mkDerivation {
name = "vs"; name = "vs";
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = "1ngq7mg02kzfysh559j3fkjh2hngmay4jjar55p2db4d9rkvqh22"; outputHash = "0v2ivq7d5smbgi5iwkczr5zcsk4gg0jq7h0flj4r7lbk6lck7v2p";
src = msvc-wine;
phases = [ "buildPhase" ]; phases = [ "buildPhase" ];
buildInputs = [ pkgs.cacert (pkgs.python3.withPackages(ps: [ ps.simplejson ps.six ])) pkgs.msitools ]; buildInputs = [ download-vs ];
buildPhase = "python $src/vsdownload.py --accept-license --dest $out"; buildPhase =
''
mkdir $out
cd $out
wfvm-run-download-vs
'';
}; };
in in
# Yes, you need to write Windoze-side SFTP absolute paths like this or it won't work.
# Just the normal state of things on that cretinous OS.
'' ''
win-exec "mkdir C:\VS" echo ${cache}
win-exec "mkdir C:\VS\VC" ln -s ${cache}/vslayout vslayout
win-exec "mkdir C:\VS\VC\Tools" win-put vslayout .
win-exec "mkdir C:\VS\kits" win-exec ".\vslayout\vs_community.exe --quiet --noweb --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US"
win-put ${vs}/VC/Tools/MSVC '/C:/VS/VC/Tools'
win-put ${vs}/kits/10 '/C:/VS/kits'
win-exec 'setx PATH "C:\VS\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64;C:\VS\kits\10\bin\10.0.18362.0\x64;%PATH%" /m'
''; '';
}; };
} }