W

Tag win11-1.1

of geneset windevbox

by dbosoft

name: devbox
parent: dbosoft/win11-24h2-enterprise/latest

capabilities:
  - nested_virtualization  # Enable for Hyper-V, WSL2, containers

cpu:
  count: 4

memory:
  startup: 16384
  minimum: 8192

drives:
  # The 39 GB system disk of the base catlet is too small for Visual Studio
  # plus the dev tools; egs extends C: to the new size on first boot.
  - name: sda
    size: 127
  - name: sdb
    size: 100
    

variables:
  - name: vs_edition
    value: "Community"
    required: false
  - name: vs_workloads
    value: "Microsoft.VisualStudio.Workload.ManagedDesktop;Microsoft.VisualStudio.Workload.NetWeb;Microsoft.VisualStudio.Workload.Azure"
    required: false
  - name: dev_tools
    value: "Git.Git,OpenJS.NodeJS.LTS,GitHub.cli"
    required: false
  - name: vscode_extensions
    value: "ms-vscode.powershell,ms-azuretools.vscode-docker,eamodio.gitlens,ms-dotnettools.csharp,ms-vscode.azure-account"
    required: false

fodder:
  # winget, plus the command line developer tools (machine-wide)
  - source: gene:dbosoft/winget:install
    variables:
      - name: packages
        value: '{{ dev_tools }}'
  
  # Dev Drive Configuration (100GB high-performance ReFS)
  - source: gene:dbosoft/windevdrive:configure
    variables:
      - name: devdrive_name
        value: "sdb"
      - name: devdrive_letter
        value: "E"
      - name: devdrive_label
        value: "DevDrive"
  
  # Hyper-V for nested virtualization (WSL2, containers, etc.)
  - source: gene:dbosoft/hyperv:install
  
  # PowerShell Core
  - source: gene:dbosoft/powershell:win-install
  
  # VS Code with Dev Drive integration
  - source: gene:dbosoft/vscode:win-vscode
    variables:
      - name: vscode_extensions
        value: '{{ vscode_extensions }}'
      - name: dev_drive_letter
        value: "E"
  
  # Visual Studio 2022 with Dev Drive (includes .NET SDK)
  - source: gene:dbosoft/msvs:vs2022
    variables:
      - name: vs_edition
        value: '{{ vs_edition }}'
      - name: vs_workloads
        value: '{{ vs_workloads }}'
      - name: include_recommended
        value: "true"
      - name: dev_drive_letter
        value: "E"
  
  # Configure Git system-wide
  - name: configure-git
    type: shellscript
    filename: configure-git.ps1
    content: |
      Write-Host "Configuring Git system-wide settings..."
      
      # Each fodder script runs with the PATH the provisioning agent started
      # with; pick up Git installed by an earlier step
      $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
      if (!(Get-Command git -ErrorAction SilentlyContinue)) {
          Write-Host "ERROR: git not found"
          exit 1
      }
      
      # System-wide Git configuration (applies to all users)
      git config --system init.defaultBranch main
      git config --system core.autocrlf true
      git config --system credential.helper manager
      if ($LASTEXITCODE -ne 0) {
          Write-Host "ERROR: git config failed with exit code $LASTEXITCODE"
          exit 1
      }
            # Create source directory structure on Dev Drive
      if (Test-Path "E:\") {
          $directories = @(
              "E:\source",
              "E:\source\repos",
              "E:\source\projects"
          )
          
          foreach ($dir in $directories) {
              if (!(Test-Path $dir)) {
                  New-Item -ItemType Directory -Path $dir -Force | Out-Null
                  Write-Host "Created: $dir"
              }
          }
          
          Write-Host "Default repository location: E:\source\repos"
      }
      
      Write-Host "Git system-wide configuration completed"