300 lines
6.5 KiB
PowerShell
300 lines
6.5 KiB
PowerShell
param (
|
||
[Alias('h', '?')]
|
||
[switch]$Help,
|
||
[Alias('no-winget')]
|
||
[switch]$NoWinget,
|
||
[Alias('only-winget')]
|
||
[switch]$OnlyWinget,
|
||
[Alias('install-extras')]
|
||
[switch]$Extras,
|
||
[Alias('only-extras')]
|
||
[switch]$OnlyExtras,
|
||
[Alias('no-choco')]
|
||
[switch]$NoChoco,
|
||
[Alias('only-choco')]
|
||
[switch]$OnlyChoco,
|
||
[Alias('no-powershell')]
|
||
[switch]$NoPowershell,
|
||
[Alias('only-powershell')]
|
||
[switch]$OnlyPowershell,
|
||
[Alias('no-pip')]
|
||
[switch]$NoPip,
|
||
[Alias('only-pip')]
|
||
[switch]$OnlyPip,
|
||
[Alias('no-npm')]
|
||
[switch]$NoNpm,
|
||
[Alias('only-npm')]
|
||
[switch]$OnlyNpm,
|
||
[Alias('no-fonts')]
|
||
[switch]$NoFonts,
|
||
[Alias('only-fonts')]
|
||
[switch]$OnlyFonts,
|
||
[Alias('no-wallpaper')]
|
||
[switch]$NoWallpaper,
|
||
[Alias('only-wallpaper')]
|
||
[switch]$OnlyWallpaper
|
||
)
|
||
|
||
if ($Help)
|
||
{
|
||
@"
|
||
requirements.ps1 – Install system requirements
|
||
|
||
USAGE:
|
||
requirements.ps1 [options]
|
||
|
||
OPTIONS:
|
||
-no-winget Disable installation via winget
|
||
-no-choco Disable installation via Chocolatey
|
||
-no-powershell Disable PowerShell module installation
|
||
-no-pip Disable Python pip package installation
|
||
-install-extras Install optional / extra components
|
||
-help, -h, -? Show this help message and exit
|
||
|
||
NOTES:
|
||
• Use single-dash options for best compatibility:
|
||
-no-winget -no-choco
|
||
|
||
• Double-dash options (--no-winget) only work in PowerShell 7+ (pwsh)
|
||
|
||
EXAMPLES:
|
||
requirements.ps1 -no-winget -no-choco
|
||
requirements.ps1 -install-extras
|
||
pwsh requirements.ps1 --no-winget --no-pip
|
||
"@
|
||
exit 0
|
||
}
|
||
|
||
function Write-Divider
|
||
{
|
||
Write-Host "################################################################################"
|
||
}
|
||
|
||
$Flags = [ordered]@{
|
||
WingetEnabled = -not $NoWinget
|
||
ExtrasEnabled = $Extras
|
||
ChocoEnabled = -not $NoChoco
|
||
PowershellEnabled = -not $NoPowershell
|
||
PipEnabled = -not $NoPip
|
||
NpmEnabled = -not $NoNpm
|
||
FontsEnabled = -not $NoFonts
|
||
WallpaperEnabled = -not $NoWallpaper
|
||
}
|
||
|
||
function Reset-Flags
|
||
{
|
||
foreach ($key in @($Flags.Keys))
|
||
{
|
||
$Flags[$key] = $false
|
||
}
|
||
}
|
||
|
||
if ($OnlyWinget)
|
||
{
|
||
Reset-Flags
|
||
$Flags.WingetEnabled = $true
|
||
}
|
||
if ($OnlyExtras)
|
||
{
|
||
Reset-Flags
|
||
$Flags.ExtrasEnabled = $true
|
||
}
|
||
if ($OnlyChoco)
|
||
{
|
||
Reset-Flags
|
||
$Flags.ChocoEnabled = $true
|
||
}
|
||
if ($OnlyPowershell)
|
||
{
|
||
Reset-Flags
|
||
$Flags.PowershellEnabled = $true
|
||
}
|
||
if ($OnlyPip)
|
||
{
|
||
Reset-Flags
|
||
$Flags.PipEnabled = $true
|
||
}
|
||
if ($OnlyNpm)
|
||
{
|
||
Reset-Flags
|
||
$Flags.NpmEnabled = $true
|
||
}
|
||
if ($OnlyFonts)
|
||
{
|
||
Reset-Flags
|
||
$Flags.FontsEnabled = $true
|
||
}
|
||
if ($OnlyWallpaper)
|
||
{
|
||
Reset-Flags
|
||
$Flags.WallpaperEnabled = $true
|
||
}
|
||
|
||
Write-Host "These providers are enabled:"
|
||
foreach ($key in $Flags.Keys)
|
||
{
|
||
if ($Flags[$key])
|
||
{
|
||
Write-Host $key
|
||
}
|
||
}
|
||
|
||
# Install requirements via winget
|
||
# Important stuff
|
||
$packages = @(
|
||
"wez.wezterm", # Teminal emulator
|
||
"Schniz.fnm", # Fast node version manager
|
||
"microsoft.teams",
|
||
"putty.putty",
|
||
"microsoft.windowsterminal",
|
||
"microsoft.git",
|
||
"jandedobbeleer.ohmyposh",
|
||
"microsoft.powershell",
|
||
"chocolatey.chocolatey", # nvim
|
||
"Python.Python.3.13", # nvim
|
||
"Python.Python.3.9", # project dependencies
|
||
"Python.Python.3.10", # isort
|
||
"JernejSimoncic.Wget", # nvim
|
||
"7zip.7zip", # nvim
|
||
"GnuWin32.gzip",
|
||
"rustlang.rustup",
|
||
"Mozilla.Firefox",
|
||
"SlackTechnologies.Slack",
|
||
"Anthropic.ClaudeCode"
|
||
)
|
||
$ExtraPackages = @(
|
||
"mRemoteNG.mRemoteNG",
|
||
"Microsoft.VisualStudio.Community",
|
||
#"Microsoft.VisualStudio.2022.Community", In favor of 2026
|
||
"JetBrains.Resharper",
|
||
"Microsoft.powertoys",
|
||
"spotify.spotify",
|
||
"microsoft.azuredatastudio",
|
||
"mozilla.thunderbird",
|
||
"Postman.Postman",
|
||
"docker.dockerdesktop",
|
||
"hrkfdn.ncspot"
|
||
)
|
||
|
||
if ($Flags.WingetEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Winget Packages"
|
||
foreach ($package in $packages)
|
||
{
|
||
winget install $package
|
||
}
|
||
|
||
powershell -c "irm https://raw.githubusercontent.com/MordechaiHadad/bob/master/scripts/install.ps1 | iex"
|
||
|
||
$toolPaths = @(
|
||
"C:\ProgramData\chocolatey\tools",
|
||
"C:\Program Files (x86)\GnuWin32\bin",
|
||
"$env:LOCALAPPDATA\bob_bin",
|
||
"$env:LOCALAPPDATA\Programs\Git\git-bash.exe"
|
||
)
|
||
|
||
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
||
|
||
foreach ($toolPath in $toolPaths) {
|
||
if ($currentPath -notlike "*$toolPath*") {
|
||
$currentPath = "$currentPath;$toolPath"
|
||
Write-Host "Added $toolPath to user PATH." -ForegroundColor Green
|
||
} else {
|
||
Write-Host "$toolPath is already in the user PATH." -ForegroundColor Yellow
|
||
}
|
||
}
|
||
|
||
[Environment]::SetEnvironmentVariable("Path", $currentPath, "User")
|
||
|
||
bob install nightly
|
||
bob use nightly
|
||
|
||
}
|
||
|
||
if ($Flags.ExtrasEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Extra Winget Packages"
|
||
foreach ($package in $ExtraPackages)
|
||
{
|
||
winget install $package
|
||
}
|
||
}
|
||
|
||
if ($Flags.NpmEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Npm Packages"
|
||
fnm install 22
|
||
fnm use 22
|
||
Set-Location ~
|
||
npm install
|
||
}
|
||
|
||
if ($Flags.ChocoEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Chocolatey Packages"
|
||
## Nvim requirements from choco, needs to be run as admin
|
||
Start-Process pwsh -Verb RunAs -ArgumentList "-Command", "choco install make unzip ripgrep zig kubelogin"
|
||
}
|
||
|
||
if ($Flags.PipEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing pip Packages"
|
||
## Nvim requirements from pip
|
||
python -m pip install debugpy neovim pillow
|
||
}
|
||
|
||
if ($Flags.PowershellEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Powershell Packages"
|
||
## Git posh
|
||
Install-Module posh-git -Scope CurrentUser -Force
|
||
}
|
||
|
||
if ($Flags.FontsEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Installing Fonts"
|
||
Set-Location ~
|
||
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/JetBrainsMono.zip
|
||
mkdir ~\fonts
|
||
Copy-Item ~\JetBrainsMono.zip ~\fonts\JetBrainsMono.zip
|
||
Set-Location ~\fonts | Out-Null
|
||
unzip JetBrainsMono.zip
|
||
Remove-Item JetBrainsMono.zip
|
||
$FontsPath = "$HOME\fonts"
|
||
|
||
$shell = New-Object -ComObject Shell.Application
|
||
$fonts = $shell.Namespace(0x14)
|
||
|
||
Get-ChildItem $FontsPath -Include *.ttf,*.otf -File | ForEach-Object {
|
||
$fonts.CopyHere($_.FullName)
|
||
}
|
||
Set-Location ~
|
||
Remove-Item ~\fonts -Force -Recurse| Out-Null
|
||
}
|
||
|
||
if ($Flags.WallpaperEnabled)
|
||
{
|
||
Write-Divider
|
||
Write-Host "Setting Wallpaper"
|
||
Add-Type @"
|
||
using System;
|
||
using System.Runtime.InteropServices;
|
||
public class Wallpaper {
|
||
[DllImport("user32.dll", SetLastError = true)]
|
||
public static extern bool SystemParametersInfo(
|
||
int uAction, int uParam, string lpvParam, int fuWinIni);
|
||
}
|
||
"@ -ErrorAction SilentlyContinue
|
||
|
||
[Wallpaper]::SystemParametersInfo(20, 0, "$HOME\wallpaper.png", 0x03) | Out-Null
|
||
}
|
||
Write-Divider
|
||
Write-Host "Done!"
|