Skip to content

Instantly share code, notes, and snippets.

@michaelkc
Created February 6, 2026 09:38
Show Gist options
  • Select an option

  • Save michaelkc/3b784329c0732e28f1cbc72d4cce27bf to your computer and use it in GitHub Desktop.

Select an option

Save michaelkc/3b784329c0732e28f1cbc72d4cce27bf to your computer and use it in GitHub Desktop.
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
# Apply with something like dsc config set --file ./ohmyposhstandalone.dsc.config.yaml
# Note that obsolete, pre-DSC installations of oh-my-posh can cause trouble
metadata:
description: Basic oh-my-posh setup and nerd font setup in Windows Terminal
resources:
# ===== Software Installation =====
- name: Install Oh My Posh
type: Microsoft.WinGet/Package
properties:
id: JanDeDobbeleer.OhMyPosh
source: winget
_exist: true
# Configure Oh My Posh
- name: Configure Oh My Posh
type: OhMyPosh/Config
properties: {}
dependsOn:
- "[resourceId('Microsoft.WinGet/Package', 'Install Oh My Posh')]"
# Install JetBrains Mono font
- name: Install JetBrains Mono Font
type: OhMyPosh/Font
properties:
states:
- name: JetBrainsMono
dependsOn:
- "[resourceId('Microsoft.WinGet/Package', 'Install Oh My Posh')]"
# Configure Oh My Posh shell integration
- name: Configure Oh My Posh Shell
type: OhMyPosh/Shell
properties: {}
dependsOn:
- "[resourceId('OhMyPosh/Config', 'Configure Oh My Posh')]"
# Set Oh My Posh to use aliens theme
- name: Set Oh My Posh Theme
type: Microsoft.DSC.Transitional/RunCommandOnSet
properties:
executable: pwsh
arguments:
- -NoProfile
- -Command
- "$appxPath = (Get-AppxPackage ohmyposh.cli).InstallLocation; $themePath = Join-Path $appxPath 'themes\\aliens.omp.json'; if (Test-Path $themePath) { $profileDir = Split-Path $PROFILE.CurrentUserCurrentHost; if (-not (Test-Path $profileDir)) { New-Item -ItemType Directory -Path $profileDir -Force | Out-Null }; oh-my-posh init pwsh --config $themePath | Out-File -FilePath $PROFILE.CurrentUserCurrentHost -Encoding utf8 -Force }"
dependsOn:
- "[resourceId('Microsoft.WinGet/Package', 'Install Oh My Posh')]"
- name: Install Windows Terminal
type: Microsoft.WinGet/Package
properties:
id: Microsoft.WindowsTerminal
source: winget
_exist: true
# Configure Windows Terminal to use JetBrains Mono and PowerShell 7 as default
- name: Configure Windows Terminal Font
type: Microsoft.DSC.Transitional/RunCommandOnSet
properties:
executable: pwsh
arguments:
- -NoProfile
- -Command
- "$wtSettings = \"$env:LOCALAPPDATA\\Packages\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\LocalState\\settings.json\"; if (Test-Path $wtSettings) { $json = Get-Content $wtSettings -Raw | ConvertFrom-Json; if (-not $json.profiles.defaults) { $json.profiles | Add-Member -MemberType NoteProperty -Name 'defaults' -Value @{} -Force }; $json.profiles.defaults | Add-Member -MemberType NoteProperty -Name 'font' -Value @{ face = 'JetBrainsMono Nerd Font' } -Force; $json | Add-Member -MemberType NoteProperty -Name 'defaultProfile' -Value '{574e775e-4f2a-5b96-ac1e-a2962a402336}' -Force; $json | ConvertTo-Json -Depth 10 | Set-Content $wtSettings -Encoding utf8 }"
dependsOn:
- "[resourceId('OhMyPosh/Font', 'Install JetBrains Mono Font')]"
- "[resourceId('Microsoft.WinGet/Package', 'Install Windows Terminal')]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment