mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 03:11:45 +00:00
Compare commits
No commits in common. "24b6d1f11571346f7492824bbcee1e3fdc441f64" and "ad9ffc0a19999be420e094cee0d089aee7f2678c" have entirely different histories.
24b6d1f115
...
ad9ffc0a19
27
README.md
27
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
|
||||
|
||||
|
@ -1,19 +1,4 @@
|
||||
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
|
||||
@ -30,7 +15,7 @@ ReadyDotfilesRepo -cwd $currentDir -url $repoUrl -destination $dotfilesRepo
|
||||
|
||||
# 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"
|
||||
@ -39,9 +24,15 @@ 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
|
||||
@ -56,7 +47,7 @@ Write-Host "============================================" -ForegroundColor DarkG
|
||||
|
||||
# Installing Nerd Fonts
|
||||
Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan
|
||||
ProcessUrlFiles -source "$dotfilesRepo\nerd-fonts" -fileExt ".zip"
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\nerd-fonts" -fileExt ".zip"
|
||||
UnzipAndInstall -source "$dotfilesRepo\nerd-fonts"
|
||||
|
||||
# Final message
|
||||
|
@ -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"
|
||||
}
|
@ -76,35 +76,34 @@ function CopyFileWithPrompt
|
||||
function ProcessUrlFiles
|
||||
{
|
||||
param (
|
||||
[string]$source,
|
||||
[Parameter(Mandatory=$false)][string]$destination,
|
||||
[string]$sourceDir,
|
||||
[Parameter(Mandatory=$false)][string]$destinationDir,
|
||||
[Parameter(Mandatory=$false)][string]$fileExt
|
||||
)
|
||||
|
||||
# Ensure the destination directory exists
|
||||
if ($destination -and (-not (Test-Path $destination)))
|
||||
if ($destinationDir -and (-not (Test-Path $destinationDir)))
|
||||
{
|
||||
Write-Host "Creating destination directory $destination..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destination | Out-Null
|
||||
Write-Host "Creating destination directory $destinationDir..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destinationDir | Out-Null
|
||||
}
|
||||
|
||||
# Create temporary directory for curl
|
||||
$appname = $source.Split('\')[-1]
|
||||
$appname = $sourceDir.Split('\')[-1]
|
||||
$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'
|
||||
$urlFiles = Get-ChildItem -Path $sourceDir -Filter '*.url'
|
||||
|
||||
foreach ($file in $urlFiles)
|
||||
{
|
||||
$url = Get-Content $file.FullName
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
$destinationPath = "$destination\$fileName"
|
||||
$destinationPath = "$destinationDir\$fileName"
|
||||
|
||||
if (-not ($url -match 'git@|https://.*\.git'))
|
||||
{
|
||||
@ -116,11 +115,11 @@ function ProcessUrlFiles
|
||||
$extension = $fileExt
|
||||
$url += $fileExt
|
||||
}
|
||||
$destinationPath = "$destination\$fileName$extension"
|
||||
$destinationPath = "$destinationDir\$fileName$extension"
|
||||
|
||||
# Respond only if destination is provided
|
||||
$conditional = " to $destinationPath"
|
||||
if (-not $destination)
|
||||
if (-not $destinationDir)
|
||||
{ $conditional = ''
|
||||
}
|
||||
|
||||
@ -129,14 +128,14 @@ function ProcessUrlFiles
|
||||
$tmpDestination = "$tmpApp\$fileName$extension"
|
||||
|
||||
# Copy only if destination is provided
|
||||
if ($destination)
|
||||
if ($destinationDir)
|
||||
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
# Use $tmpApp as destination in case of git repo
|
||||
if (-not $destination)
|
||||
if (-not $destinationDir)
|
||||
{ $destinationPath = "$tmpApp\$fileName"
|
||||
}
|
||||
|
||||
@ -151,7 +150,7 @@ function ProcessUrlFiles
|
||||
Write-Host "Cloning $fileName from $url to $destinationPath..." -ForegroundColor Cyan
|
||||
git clone $url $destinationPath
|
||||
}
|
||||
Pop-Location
|
||||
Set-Location -
|
||||
}
|
||||
|
||||
# Function to expand zip archives and copy to destination paths
|
||||
@ -175,7 +174,7 @@ function UnzipAndInstall
|
||||
{
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
Write-Host "Extracting archive $tmpApp\$fileName.zip to $tmpApp\$fileName\..." -ForegroundColor Cyan
|
||||
Expand-Archive "$tmpApp\$fileName.zip" -DestinationPath "$tmpApp\$fileName" | Out-Null
|
||||
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
|
||||
|
@ -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,29 +0,0 @@
|
||||
function InstallWinget
|
||||
{
|
||||
# Reference: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
|
||||
$progressPreference = 'silentlyContinue'
|
||||
Write-Host "Installing WinGet PowerShell module from PSGallery..."
|
||||
Install-PackageProvider -Name NuGet -Force | Out-Null
|
||||
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
|
||||
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
|
||||
Repair-WinGetPackageManager
|
||||
}
|
||||
|
||||
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,60 +0,0 @@
|
||||
function InstallWSL
|
||||
{
|
||||
# Reference: https://learn.microsoft.com/en-us/windows/wsl/install-manual
|
||||
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
|
||||
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
|
||||
wsl.exe --update
|
||||
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
|
||||
wsl.exe -u root echo "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 ./windows.psm1
|
||||
|
||||
ProcessUrlFiles -sourceDir $source
|
||||
|
||||
Push-Location
|
||||
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