mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 03:11:45 +00:00
Compare commits
No commits in common. "06977c0db5a3270a70294594a0c0f43afb5f5458" and "f9db026b1614b9ee672dcace37775a8f9a880563" have entirely different histories.
06977c0db5
...
f9db026b16
34
README.md
34
README.md
@ -33,8 +33,31 @@ These tools include the following for Windows Installs (Recommended using [Choco
|
||||
- [Python](https://www.python.org/)
|
||||
- [Composer](https://getcomposer.org/)
|
||||
|
||||
> **NOTE**
|
||||
> For more information, simply see all [util/](./util) installation modules.
|
||||
<details><summary>Windows Subsystem for Linux</summary>
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh
|
||||
sudo -E bash nodesource_setup.sh
|
||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||
sudo apt install make gcc ripgrep unzip git xclip neovim nodejs python3-venv
|
||||
curl https://sh.rustup.rs -sSf | sh
|
||||
curl -LO https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
|
||||
sudo rm -rf /usr/local/go
|
||||
sudo tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Winget and Chocolatey</summary>
|
||||
|
||||
```pwsh
|
||||
winget install chocolatey.chocolatey Neovide.Neovide Alacritty.Alacritty Git.Git GoLang.Go Microsoft.DotNet.SDK.8 OpenJS.NodeJS.LTS Python.Python.3.12 Rustlang.Rustup
|
||||
choco install neovim ripgrep curl wget fd unzip gzip mingw make
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Installation
|
||||
|
||||
@ -50,9 +73,6 @@ Alternatively, feel free to run the [install script](./install_windows.ps1) afte
|
||||
cloning the repository or directly execute it from shell:
|
||||
|
||||
```pwsh
|
||||
irm https://api.github.com/repos/Baipyrus/dotfiles/zipball -O "$env:TMP\dotfiles.zip"
|
||||
Expand-Archive "$env:TMP\dotfiles.zip" -D "$env:TMP\dotfiles" -F
|
||||
gci "$env:TMP\dotfiles\**\install_windows.ps1" | select -F 1 | % {
|
||||
saps powershell.exe -Wait -Wo $_.DirectoryName -A "-Ex", "Bypass", "-F", $_.FullName
|
||||
}
|
||||
# Using 'Invoke-RestMethod' and 'Invoke-Expression'
|
||||
irm 'https://raw.githubusercontent.com/Baipyrus/dotfiles/main/install_windows.ps1' | iex
|
||||
```
|
||||
|
@ -1,30 +1,154 @@
|
||||
Import-Module ./util/chocolatey.psm1
|
||||
Import-Module ./util/windows.psm1
|
||||
Import-Module ./util/winget.psm1
|
||||
Import-Module ./util/wsl.psm1
|
||||
|
||||
|
||||
# (Optionally) Install required Software
|
||||
WingetInstall
|
||||
ChocolateyInstall
|
||||
WSLInstall
|
||||
|
||||
Write-Host "Installation Steps complete!" -ForegroundColor Cyan
|
||||
$continue = Read-Host "Continue with configuration? [Y/n]"
|
||||
if ($continue.ToLower() -eq 'n')
|
||||
{ return
|
||||
}
|
||||
|
||||
|
||||
# Define paths for tools and configurations
|
||||
$dotfilesRepo = (Get-Location).Path
|
||||
$dotfilesRepo = "$env:TMP\dotfiles"
|
||||
$alacrittyConfigDir = "$env:APPDATA\alacritty"
|
||||
$psProfile = "$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
|
||||
$repoUrl = "https://github.com/Baipyrus/dotfiles.git"
|
||||
|
||||
# Function to determine if the current directory is the dotfiles repository
|
||||
function IsGitRepository
|
||||
{
|
||||
param (
|
||||
[string]$dir,
|
||||
[string]$url
|
||||
)
|
||||
|
||||
try
|
||||
{
|
||||
$isRepo = git -C $dir rev-parse --is-inside-work-tree 2>$null
|
||||
$originUrl = git -C $dir remote get-url origin 2>$null
|
||||
return $isRepo -eq 'true' -and $originUrl -eq $url
|
||||
} catch
|
||||
{
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Check if the script is running inside the dotfiles repository
|
||||
$currentDir = (Get-Location).Path
|
||||
|
||||
if (IsGitRepository -dir $currentDir -url $repoUrl)
|
||||
{
|
||||
Write-Host "Already inside the dotfiles repository. Skipping clone step and pulling..." -ForegroundColor Yellow
|
||||
$dotfilesRepo = $currentDir
|
||||
git pull
|
||||
} else
|
||||
{
|
||||
# Clone dotfiles repository to TMP if not already inside it
|
||||
if (-not (Test-Path $dotfilesRepo))
|
||||
{
|
||||
Write-Host "Cloning dotfiles repository..." -ForegroundColor Cyan
|
||||
git clone $repoUrl $dotfilesRepo
|
||||
} else
|
||||
{
|
||||
Write-Host "Pulling latest changes from dotfiles repository..." -ForegroundColor Cyan
|
||||
git -C $dotfilesRepo pull
|
||||
}
|
||||
}
|
||||
|
||||
# Function to copy files with overwrite prompt
|
||||
function CopyFileWithPrompt
|
||||
{
|
||||
param (
|
||||
[string]$source,
|
||||
[string]$destination
|
||||
)
|
||||
|
||||
if (Test-Path $destination)
|
||||
{
|
||||
$overwrite = Read-Host "File $destination exists. Overwrite? (y/n)"
|
||||
if ($overwrite -ne 'y')
|
||||
{
|
||||
Write-Host "Skipping $destination" -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
}
|
||||
Copy-Item -Path $source -Destination $destination -Force
|
||||
}
|
||||
|
||||
# Function to handle URL files: download files or clone repositories
|
||||
function ProcessUrlFiles
|
||||
{
|
||||
param (
|
||||
[string]$sourceDir,
|
||||
[Parameter(Mandatory=$false)][string]$destinationDir,
|
||||
[Parameter(Mandatory=$false)][string]$fileExt
|
||||
)
|
||||
|
||||
# Ensure the destination directory exists
|
||||
if ($destinationDir -and (-not (Test-Path $destinationDir)))
|
||||
{
|
||||
Write-Host "Creating destination directory $destinationDir..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destinationDir | Out-Null
|
||||
}
|
||||
|
||||
# Create temporary directory for curl
|
||||
$appname = $sourceDir.Split('\')[-1]
|
||||
$tmpApp = "$env:TMP\$appname-config"
|
||||
if (-not (Test-Path $tmpApp))
|
||||
{ New-Item -ItemType Directory -Path $tmpApp | Out-Null
|
||||
}
|
||||
Set-Location $tmpApp
|
||||
|
||||
# Find all .url files in the source directory
|
||||
$urlFiles = Get-ChildItem -Path $sourceDir -Filter '*.url'
|
||||
|
||||
foreach ($file in $urlFiles)
|
||||
{
|
||||
$url = Get-Content $file.FullName
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
$destinationPath = "$destinationDir\$fileName"
|
||||
|
||||
if (-not ($url -match 'git@|https://.*\.git'))
|
||||
{
|
||||
# Otherwise, download the file
|
||||
$extension = [System.IO.Path]::GetExtension($url)
|
||||
# Force apply $fileExt if given
|
||||
if ($fileExt)
|
||||
{
|
||||
$extension = $fileExt
|
||||
$url += $fileExt
|
||||
}
|
||||
$destinationPath = "$destinationDir\$fileName$extension"
|
||||
|
||||
# Respond only if destination is provided
|
||||
$conditional = " to $destinationPath"
|
||||
if (-not $destinationDir)
|
||||
{ $conditional = ''
|
||||
}
|
||||
|
||||
Write-Host "Downloading $fileName from $url$conditional..." -ForegroundColor Cyan
|
||||
Invoke-RestMethod $url -OutFile $fileName$extension
|
||||
$tmpDestination = "$tmpApp\$fileName$extension"
|
||||
|
||||
# Copy only if destination is provided
|
||||
if ($destinationDir)
|
||||
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
# Use $tmpApp as destination in case of git repo
|
||||
if (-not $destinationDir)
|
||||
{ $destinationPath = "$tmpApp\$fileName"
|
||||
}
|
||||
|
||||
# If the URL is a git repository, pull it
|
||||
if (IsGitRepository -dir $destinationPath -url $url)
|
||||
{
|
||||
Write-Host "Pulling inside existing repository $fileName..." -ForegroundColor Cyan
|
||||
git -C $destinationPath pull
|
||||
continue
|
||||
}
|
||||
# Or otherwise clone it
|
||||
Write-Host "Cloning $fileName from $url to $destinationPath..." -ForegroundColor Cyan
|
||||
git clone $url $destinationPath
|
||||
}
|
||||
Set-Location -
|
||||
}
|
||||
|
||||
# Setting up Alacritty Configuration
|
||||
Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan
|
||||
ProcessUrlFiles -source "$dotfilesRepo\alacritty" -destination $alacrittyConfigDir
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\alacritty" -destinationDir $alacrittyConfigDir
|
||||
|
||||
# Copy the main Alacritty configuration file
|
||||
CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir\alacritty.toml"
|
||||
@ -33,19 +157,19 @@ CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir
|
||||
Write-Host "Setting up Neovim configuration..." -ForegroundColor Cyan
|
||||
$ubuntu = wsl.exe -l --all | Where-Object { $_.Replace("`0", "") -match '^Ubuntu' }
|
||||
if ($null -eq $ubuntu)
|
||||
{ ProcessUrlFiles -source "$dotfilesRepo\nvim" -destination "$env:LOCALAPPDATA"
|
||||
{ ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDATA"
|
||||
} else
|
||||
{ InstallWSLNeovim -source "$dotfilesRepo\nvim"
|
||||
{
|
||||
# TODO: Expand into generic WSL setup while installing required dev tools
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim"
|
||||
Set-Location "$env:TMP\nvim-config"
|
||||
Write-Host "Copying (forcably) configuration to WSL..." -ForegroundColor Yellow
|
||||
wsl.exe cp -rf . ~/.config/ 2>$null | Out-Null
|
||||
Set-Location -
|
||||
}
|
||||
|
||||
# Setting up PowerShell Profile
|
||||
Write-Host "Setting up PowerShell profile..." -ForegroundColor Cyan
|
||||
# Create local PowerShell profile directory
|
||||
$psDir = Split-Path -Path $psProfile
|
||||
if (-not (Test-Path $psDir))
|
||||
{ New-Item -ItemType Directory -Path $psDir | Out-Null
|
||||
}
|
||||
# Copy existing startup script to destination
|
||||
CopyFileWithPrompt "$dotfilesRepo\PowerShell\Microsoft.PowerShell_profile.ps1" $psProfile
|
||||
|
||||
# Setting up self-made ProxySwitcher
|
||||
@ -54,11 +178,37 @@ Write-Host "Setting up ProxySwitcher via subscript..." -ForegroundColor Cyan
|
||||
Invoke-RestMethod 'https://raw.githubusercontent.com/Baipyrus/ProxySwitcher/main/install.ps1' | Invoke-Expression
|
||||
Write-Host "============================================" -ForegroundColor DarkGray
|
||||
|
||||
function UnzipAndInstall
|
||||
{
|
||||
param (
|
||||
[string]$source
|
||||
)
|
||||
|
||||
# Create temporary directory for unzip
|
||||
$appname = $source.Split('\')[-1]
|
||||
$tmpApp = "$env:TMP\$appname-config"
|
||||
if (-not (Test-Path $tmpApp))
|
||||
{ New-Item -ItemType Directory -Path $tmpApp | Out-Null
|
||||
}
|
||||
|
||||
# Find all .url files in the source directory
|
||||
$urlFiles = Get-ChildItem -Path $source -Filter '*.url'
|
||||
|
||||
foreach ($file in $urlFiles)
|
||||
{
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
Write-Host "Extracting archive $tmpApp\$fileName.zip to $tmpApp\$fileName\..." -ForegroundColor Cyan
|
||||
unzip -o "$tmpApp\$fileName.zip" -d "$tmpApp\$fileName" | Out-Null
|
||||
|
||||
Write-Host "Installing fonts from $tmpApp\$fileName\ for current user..." -ForegroundColor Cyan
|
||||
Copy-Item -Path "$tmpApp\$fileName\*" -Destination "$env:LOCALAPPDATA\Microsoft\Windows\Fonts\" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Installing Nerd Fonts
|
||||
Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan
|
||||
ProcessUrlFiles -source "$dotfilesRepo\nerd-fonts" -fileExt ".zip" -progress $false
|
||||
Get-ChildItem -Path "$env:TMP\nerd-fonts-config" -Filter "*.zip" | `
|
||||
ForEach-Object { InstallNerdFont -source $_.FullName }
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\nerd-fonts" -fileExt ".zip"
|
||||
UnzipAndInstall -source "$dotfilesRepo\nerd-fonts"
|
||||
|
||||
# Final message
|
||||
Write-Host "Windows setup complete!" -ForegroundColor Green
|
||||
|
@ -1,10 +0,0 @@
|
||||
neovim
|
||||
ripgrep
|
||||
wget
|
||||
curl
|
||||
fd
|
||||
unzip
|
||||
gzip
|
||||
mingw
|
||||
make
|
||||
composer
|
@ -1,17 +0,0 @@
|
||||
function InstallPackages
|
||||
{
|
||||
choco.exe install (Get-Content ./util/chocolatey.list)
|
||||
}
|
||||
|
||||
function ChocolateyInstall
|
||||
{
|
||||
$install = Read-Host "Install Chocolatey Packages now? [Y/n]"
|
||||
if ($install.ToLower() -eq 'n')
|
||||
{ return
|
||||
}
|
||||
|
||||
# Start admin process, import this script, run 'InstallPackages' function
|
||||
Start-Process powershell.exe -Verb RunAs -Wait `
|
||||
-ArgumentList "-ExecutionPolicy", "Bypass", `
|
||||
"-C", "cd $pwd; ipmo ./util/chocolatey.psm1; InstallPackages"
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
# Function to determine if the current directory is the dotfiles repository
|
||||
function IsGitRepository
|
||||
{
|
||||
param (
|
||||
[string]$dir,
|
||||
[string]$url
|
||||
)
|
||||
|
||||
try
|
||||
{
|
||||
$isRepo = git -C $dir rev-parse --is-inside-work-tree 2>$null
|
||||
$originUrl = git -C $dir remote get-url origin 2>$null
|
||||
return $isRepo -eq 'true' -and $originUrl -eq $url
|
||||
} catch
|
||||
{
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Function to copy files with overwrite prompt
|
||||
function CopyFileWithPrompt
|
||||
{
|
||||
param (
|
||||
[string]$source,
|
||||
[string]$destination
|
||||
)
|
||||
|
||||
if (Test-Path $destination)
|
||||
{
|
||||
$overwrite = Read-Host "File $destination exists. Overwrite? (y/N)"
|
||||
if ($overwrite.ToLower() -ne 'y')
|
||||
{
|
||||
Write-Host "Skipping $destination" -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
}
|
||||
Copy-Item -Path $source -Destination $destination -Force
|
||||
}
|
||||
|
||||
# Function to handle URL files: download files or clone repositories
|
||||
function ProcessUrlFiles
|
||||
{
|
||||
param (
|
||||
[string]$source,
|
||||
[Parameter(Mandatory=$false)][string]$destination,
|
||||
[Parameter(Mandatory=$false)][string]$fileExt,
|
||||
[bool]$progress=$true
|
||||
)
|
||||
|
||||
# Disable progressbar for faster download
|
||||
$progressPreference = 'continue'
|
||||
if (-not $progress)
|
||||
{ $progressPreference = 'silentlyContinue'
|
||||
}
|
||||
|
||||
# Ensure the destination directory exists
|
||||
if ($destination -and (-not (Test-Path $destination)))
|
||||
{
|
||||
Write-Host "Creating destination directory $destination..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destination | Out-Null
|
||||
}
|
||||
|
||||
# Create temporary directory for curl
|
||||
$appname = Split-Path -Leaf $source
|
||||
$tmpApp = "$env:TMP\$appname-config"
|
||||
if (-not (Test-Path $tmpApp))
|
||||
{ New-Item -ItemType Directory -Path $tmpApp | Out-Null
|
||||
}
|
||||
Push-Location
|
||||
Set-Location $tmpApp
|
||||
|
||||
# Find all .url files in the source directory
|
||||
$urlFiles = Get-ChildItem -Path $source -Filter '*.url'
|
||||
|
||||
foreach ($file in $urlFiles)
|
||||
{
|
||||
$url = Get-Content $file.FullName
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
$destinationPath = "$destination\$fileName"
|
||||
|
||||
if (-not ($url -match 'git@|https://.*\.git'))
|
||||
{
|
||||
# Otherwise, download the file
|
||||
$extension = [System.IO.Path]::GetExtension($url)
|
||||
# Force apply $fileExt if given
|
||||
if ($fileExt)
|
||||
{
|
||||
$extension = $fileExt
|
||||
$url += $fileExt
|
||||
}
|
||||
$destinationPath = "$destination\$fileName$extension"
|
||||
|
||||
# Respond only if destination is provided
|
||||
$conditional = " to $destinationPath"
|
||||
if (-not $destination)
|
||||
{ $conditional = ''
|
||||
}
|
||||
|
||||
Write-Host "Downloading $fileName from $url$conditional..." -ForegroundColor Cyan
|
||||
Invoke-WebRequest $url -OutFile $fileName$extension
|
||||
$tmpDestination = "$tmpApp\$fileName$extension"
|
||||
|
||||
# Copy only if destination is provided
|
||||
if ($destination)
|
||||
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
# Use $tmpApp as destination in case of git repo
|
||||
if (-not $destination)
|
||||
{ $destinationPath = "$tmpApp\$fileName"
|
||||
}
|
||||
|
||||
# If the URL is a git repository, pull it
|
||||
if (IsGitRepository -dir $destinationPath -url $url)
|
||||
{
|
||||
Write-Host "Pulling inside existing repository $fileName..." -ForegroundColor Cyan
|
||||
git -C $destinationPath pull
|
||||
continue
|
||||
}
|
||||
# Or otherwise clone it
|
||||
Write-Host "Cloning $fileName from $url to $destinationPath..." -ForegroundColor Cyan
|
||||
git clone $url $destinationPath
|
||||
}
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Function to unzip and install nerd fonts
|
||||
function InstallNerdFont
|
||||
{
|
||||
param (
|
||||
[string]$source
|
||||
)
|
||||
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($source)
|
||||
$parent = Get-ChildItem $source | `
|
||||
Select-Object -ExpandProperty Directory | `
|
||||
Select-Object -ExpandProperty FullName
|
||||
$destination = "$parent\$fileName"
|
||||
|
||||
# Create destination directory
|
||||
if (-not (Test-Path $destination))
|
||||
{ New-Item -ItemType Directory -Path $destination | Out-Null
|
||||
}
|
||||
|
||||
# Extract contents of zip archive
|
||||
Write-Host "Extracting archive $source to $destination..." -ForegroundColor Cyan
|
||||
Expand-Archive $source -DestinationPath $destination -Force | Out-Null
|
||||
|
||||
# Install extracted fonts
|
||||
$fontFiles = Get-ChildItem -Path $destination -Include "*.ttf", "*.otf"
|
||||
|
||||
foreach ($font in $fontFiles)
|
||||
{
|
||||
InstallFont $font
|
||||
}
|
||||
}
|
||||
|
||||
# Reference: https://www.alkanesolutions.co.uk/2021/12/06/installing-fonts-with-powershell/
|
||||
function InstallFont
|
||||
{
|
||||
param
|
||||
(
|
||||
[System.IO.FileInfo]$file
|
||||
)
|
||||
|
||||
# Prerequisites / Constants
|
||||
Add-Type -AssemblyName PresentationCore
|
||||
$destination = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts\"
|
||||
$regKey = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts"
|
||||
|
||||
# Create destination directory
|
||||
if (-not (Test-Path $destination))
|
||||
{ New-Item -ItemType Directory -Path $destination | Out-Null
|
||||
}
|
||||
|
||||
# Get Glyph
|
||||
$glyph = New-Object -TypeName Windows.Media.GlyphTypeface -ArgumentList $file.FullName
|
||||
|
||||
$family = $glyph.Win32FamilyNames['en-us']
|
||||
if ($null -eq $family)
|
||||
{ $family = $glyph.Win32FamilyNames.Values | Select-Object -First 1
|
||||
}
|
||||
|
||||
$face = $glyph.Win32FaceNames['en-us']
|
||||
if ($null -eq $face)
|
||||
{ $face = $glyph.Win32FaceNames.Values | Select-Object -First 1
|
||||
}
|
||||
|
||||
$name = ("$family $face").Trim()
|
||||
switch ($file.Extension)
|
||||
{
|
||||
".ttf"
|
||||
{ $name = "$name (TrueType)"
|
||||
}
|
||||
".otf"
|
||||
{ $name = "$name (OpenType)"
|
||||
}
|
||||
}
|
||||
|
||||
$destFileName = Join-Path -Path $destination -ChildPath $file.Name
|
||||
Write-Host "Installing font: $file with font name '$name'"
|
||||
If (-not (Test-Path $destFileName))
|
||||
{ Copy-Item -Path $file.FullName -Destination $destFileName -Force
|
||||
}
|
||||
|
||||
Write-Host "Registering font: $file with font name '$name'"
|
||||
$keyValue = Get-ItemProperty -Name $name -Path $regKey -ErrorAction SilentlyContinue
|
||||
If (-not $keyValue)
|
||||
{
|
||||
New-ItemProperty -Name $name -Path $regKey `
|
||||
-PropertyType string -Value $file.Name `
|
||||
-Force -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
Git.Git
|
||||
Microsoft.OpenJDK.21
|
||||
Alacritty.Alacritty
|
||||
OpenJS.NodeJS.LTS
|
||||
Chocolatey.Chocolatey
|
||||
Microsoft.DotNet.SDK.8
|
||||
Microsoft.PowerShell
|
||||
GoLang.Go
|
||||
Python.Python.3.12
|
||||
Rustlang.Rustup
|
||||
rjpcomputing.luaforwindows
|
@ -1,39 +0,0 @@
|
||||
function InstallWinget
|
||||
{
|
||||
$progressPreference = 'silentlyContinue'
|
||||
$download = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
||||
$setup = "$env:TMP\winget_setup.msixbundle"
|
||||
|
||||
if (-not (Test-Path $setup))
|
||||
{
|
||||
$releases = Invoke-RestMethod $download
|
||||
$assets = $releases | Select-Object -ExpandProperty "assets"
|
||||
$installer = $assets | Where-Object "name" -Match "msixbundle"
|
||||
$url = $installer | Select-Object -ExpandProperty "browser_download_url"
|
||||
|
||||
Write-Host "Downloading WinGet '.msixbundle' installer ..."
|
||||
Invoke-WebRequest $url -OutFile $setup
|
||||
}
|
||||
|
||||
Write-Host "Installing WinGet app package..."
|
||||
Add-AppxPackage -Path $setup
|
||||
}
|
||||
|
||||
function WingetInstall
|
||||
{
|
||||
$update = Read-Host "Install/Update WinGet now? [Y/n]"
|
||||
if ($update.ToLower() -ne 'n')
|
||||
{
|
||||
# Start admin process, import this script, run 'InstallPackages' function
|
||||
Start-Process powershell.exe -Verb RunAs -Wait `
|
||||
-ArgumentList "-ExecutionPolicy", "Bypass", `
|
||||
"-C", "cd $pwd; ipmo ./util/winget.psm1; InstallWinget"
|
||||
}
|
||||
|
||||
$install = Read-Host "Install WinGet Packages now? [Y/n]"
|
||||
if ($install.ToLower() -eq 'n')
|
||||
{ return
|
||||
}
|
||||
|
||||
winget.exe install -s winget --accept-source-agreements (Get-Content ./util/winget.list)
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
make
|
||||
gcc
|
||||
ripgrep
|
||||
unzip
|
||||
git
|
||||
xclip
|
||||
python3
|
||||
python3-venv
|
||||
composer
|
||||
luarocks
|
||||
fd-find
|
||||
python3-pip
|
||||
python3-pynvim
|
||||
openjdk-21-jdk-headless
|
@ -1,61 +0,0 @@
|
||||
function InstallWSL
|
||||
{
|
||||
Write-Host "Enabling and downloading required Windows Features..."
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All -NoRestart | Out-Null
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -All -NoRestart | Out-Null
|
||||
Write-Host "Installing WSL2..."
|
||||
wsl.exe --install --no-distribution
|
||||
wsl.exe --set-default-version 2
|
||||
}
|
||||
|
||||
function WSLInstall
|
||||
{
|
||||
# Skip if any WSL2 installations can be found
|
||||
$installations = wsl.exe -l -v
|
||||
$filtered = $installations | Where-Object { $_.Replace("`0", '') -match '^.{2}Ubuntu' }
|
||||
$versions = $filtered | ForEach-Object { $_.Substring($_.LastIndexOf(' ') + 1) }
|
||||
if ($null -ne $versions -and $versions.Contains('2'))
|
||||
{ return
|
||||
}
|
||||
|
||||
$update = Read-Host "Install/Update WSL2 now? [Y/n]"
|
||||
if ($update.ToLower() -ne 'n')
|
||||
{
|
||||
# Start admin process, import this script, run 'InstallPackages' function
|
||||
Start-Process powershell.exe -Verb RunAs -Wait `
|
||||
-ArgumentList "-ExecutionPolicy", "Bypass", `
|
||||
"-C", "cd $pwd; ipmo ./util/wsl.psm1; InstallWSL"
|
||||
}
|
||||
|
||||
$install = Read-Host "Install WSL Distribution now? [Y/n]"
|
||||
if ($install.ToLower() -eq 'n')
|
||||
{ return
|
||||
}
|
||||
|
||||
wsl.exe --install -d Ubuntu
|
||||
|
||||
# Add newly created user to sudoers group
|
||||
$user = wsl.exe cut "-d:" "-f1" /etc/passwd | Select-Object -Last 1
|
||||
wsl.exe -u root echo "$user ALL=(ALL) NOPASSWD:ALL" ">>" "/etc/sudoers.d/$user"
|
||||
|
||||
# Update packages and install from list
|
||||
wsl.exe sudo apt update "&&" sudo apt upgrade "-y"
|
||||
wsl.exe sudo apt install "-y" (Get-Content ./util/wsl.list)
|
||||
}
|
||||
|
||||
function InstallWSLNeovim
|
||||
{
|
||||
param (
|
||||
[string]$source
|
||||
)
|
||||
|
||||
Import-Module ./util/windows.psm1
|
||||
|
||||
Push-Location
|
||||
ProcessUrlFiles -source $source
|
||||
Set-Location "$env:TMP\nvim-config"
|
||||
|
||||
Write-Host "Copying (forcably) configuration to WSL..." -ForegroundColor Yellow
|
||||
wsl.exe cp -rf . ~/.config/ 2>$null | Out-Null
|
||||
Pop-Location
|
||||
}
|
Loading…
Reference in New Issue
Block a user