]>
| Commit | Line | Data |
|---|---|---|
| 3c096107 MV |
1 | # dotfiles |
| 2 | ||
| 3 | Windows development-box provisioning scripts. | |
| 4 | ||
| 5 | `setup-windows.bat` takes a fresh Windows install to a working C++ / native | |
| 6 | development environment: editors and shells, Python, the Visual Studio 2022 | |
| 7 | toolchain (including the Clang and Windows XP targeting toolsets), the Windows | |
| 8 | Driver Kit, and a handful of analysis tools (Sysinternals, OpenCppCoverage, | |
| 452f525c MV |
9 | BinSkim, the Windows Performance Toolkit). It also sets the box up to be driven |
| 10 | remotely: OpenSSH Server plus an rsync build for Windows, which is what makes a | |
| 11 | throwaway VM reachable from a Linux host. | |
| 3c096107 MV |
12 | |
| 13 | ## Files | |
| 14 | ||
| 15 | | File | Purpose | | |
| 16 | | --- | --- | | |
| 17 | | `setup-windows.bat` | Entry point. Runs the non-elevated, per-user half (winget installs, user `PATH` edits, global git config), then launches the elevated half and prints its log. | | |
| 452f525c | 18 | | `setup-windows-with-uac.ps1` | The elevated half, started via UAC by the batch file. Enables `ssh-agent`, installs and starts OpenSSH Server, installs `rsync.exe` to the machine `PATH`, then installs Visual Studio 2022 Community with the required components, the WDK, and the Windows Performance Toolkit. Can also be run directly from an Administrator prompt. | |
| 3c096107 MV |
19 | |
| 20 | ## Usage | |
| 21 | ||
| 22 | 1. **Edit `setup-windows.bat` first.** The global git identity near the middle of | |
| 23 | the file is placeholder text: | |
| 24 | ||
| 25 | ```bat | |
| 26 | git config --global user.name "PLACEHOLDER_NAME" | |
| 27 | git config --global user.email "PLACEHOLDER_EMAIL" | |
| 28 | ``` | |
| 29 | ||
| 30 | Substitute your own name and email, or comment both lines out to keep your | |
| 31 | identity per-repository. | |
| 32 | ||
| 33 | 2. Run it from a normal (non-elevated) prompt: | |
| 34 | ||
| 35 | ```bat | |
| 36 | setup-windows.bat | |
| 37 | ``` | |
| 38 | ||
| 39 | It will raise a single UAC prompt for the elevated half. Accept it — declining | |
| 40 | leaves Visual Studio and the WDK uninstalled, and the script says so. | |
| 41 | ||
| 42 | 3. Restart your shell afterwards so the updated user `PATH` is picked up, and | |
| 43 | reboot if a step reported that a restart was required. | |
| 44 | ||
| 45 | ## Notes | |
| 46 | ||
| 47 | - The elevated half writes a transcript to `setup-windows-uac.log` next to the | |
| 48 | script; the batch file prints it when the elevated window closes. The log is | |
| 49 | gitignored, as it contains local paths. | |
| 50 | - Both halves are idempotent — re-running skips anything already installed. | |
| 452f525c MV |
51 | BinSkim in particular checks NuGet for the newest stable version *before* |
| 52 | downloading: the package is a self-contained .NET build well over 100 MB, and | |
| 53 | re-provisioning an up-to-date box should not pay for it. The installed version | |
| 54 | is tracked in `nupkg-version.txt` beside the tool. | |
| 55 | - **Remote access.** OpenSSH Server is installed from the Windows on-demand | |
| 56 | capability (10/1809+), set to start automatically, and given an inbound TCP 22 | |
| 57 | firewall rule on *all* profiles — a VM's host-only or bridged adapter is | |
| 58 | routinely classified Public, which is the usual reason a running `sshd` is | |
| 59 | unreachable. Windows ships no `rsync`, so a build of it | |
| 60 | ([nuket/rsync-windows](https://github.com/nuket/rsync-windows)) is installed to | |
| 61 | `C:\Tools\rsync` and added to the **machine** `PATH`. That last detail matters: | |
| 62 | the remote end of an `rsync` runs non-interactively, with no login shell, and | |
| 63 | Win32-OpenSSH builds that environment from the registry `PATH` rather than from | |
| 64 | a profile. Key auth needs `~/.ssh/authorized_keys` ACL'd to just you and | |
| 65 | `SYSTEM`; accounts in the Administrators group use | |
| 66 | `C:\ProgramData\ssh\administrators_authorized_keys` instead. | |
| 3c096107 MV |
67 | - Visual Studio is installed in three labelled passes (base workload, Clang/LLVM, |
| 68 | XP toolset) so a failure identifies which component group is responsible. | |
| 69 | - The scripts were extracted from a native Windows project, so the component | |
| 70 | selection is tuned for that: Spectre-mitigated runtimes, the v141/XP toolset, | |
| 71 | and driver-kit headers. Trim the component lists in the `.ps1` if you don't | |
| 72 | need them — each group is a plain array near the top. |