mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-25 02:41:45 +00:00
Compare commits
20 Commits
ad9ffc0a19
...
24b6d1f115
Author | SHA1 | Date | |
---|---|---|---|
24b6d1f115 | |||
52e9367b04 | |||
8ed8d2d411 | |||
eaf1e8e9f3 | |||
8c6dcd4590 | |||
ff07ff7d17 | |||
7f7fc0a8ba | |||
c5c7703e00 | |||
df70d04ddc | |||
eed5118341 | |||
5014da3a46 | |||
509ebf7437 | |||
cb66813a8b | |||
9cc28a14e1 | |||
1e19a5e1cf | |||
e2edd0122e | |||
ec067674d3 | |||
d95ba9823d | |||
3a849a448f | |||
5090a04e95 |
27
README.md
27
README.md
@ -33,31 +33,8 @@ These tools include the following for Windows Installs (Recommended using [Choco
|
||||
- [Python](https://www.python.org/)
|
||||
- [Composer](https://getcomposer.org/)
|
||||
|
||||
<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>
|
||||
> **NOTE**
|
||||
> For more information, simply see all [util/](./util) installation modules.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -1,4 +1,19 @@
|
||||
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
|
||||
@ -15,7 +30,7 @@ ReadyDotfilesRepo -cwd $currentDir -url $repoUrl -destination $dotfilesRepo
|
||||
|
||||
# Setting up Alacritty Configuration
|
||||
Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\alacritty" -destinationDir $alacrittyConfigDir
|
||||
ProcessUrlFiles -source "$dotfilesRepo\alacritty" -destination $alacrittyConfigDir
|
||||
|
||||
# Copy the main Alacritty configuration file
|
||||
CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir\alacritty.toml"
|
||||
@ -24,15 +39,9 @@ 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 -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDATA"
|
||||
{ ProcessUrlFiles -source "$dotfilesRepo\nvim" -destination "$env:LOCALAPPDATA"
|
||||
} else
|
||||
{
|
||||
# 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 -
|
||||
{ InstallWSLNeovim -source "$dotfilesRepo\nvim"
|
||||
}
|
||||
|
||||
# Setting up PowerShell Profile
|
||||
@ -47,7 +56,7 @@ Write-Host "============================================" -ForegroundColor DarkG
|
||||
|
||||
# Installing Nerd Fonts
|
||||
Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan
|
||||
ProcessUrlFiles -sourceDir "$dotfilesRepo\nerd-fonts" -fileExt ".zip"
|
||||
ProcessUrlFiles -source "$dotfilesRepo\nerd-fonts" -fileExt ".zip"
|
||||
UnzipAndInstall -source "$dotfilesRepo\nerd-fonts"
|
||||
|
||||
# Final message
|
||||
|
10
util/chocolatey.list
Normal file
10
util/chocolatey.list
Normal file
@ -0,0 +1,10 @@
|
||||
neovim
|
||||
ripgrep
|
||||
wget
|
||||
curl
|
||||
fd
|
||||
unzip
|
||||
gzip
|
||||
mingw
|
||||
make
|
||||
composer
|
17
util/chocolatey.psm1
Normal file
17
util/chocolatey.psm1
Normal file
@ -0,0 +1,17 @@
|
||||
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,34 +76,35 @@ function CopyFileWithPrompt
|
||||
function ProcessUrlFiles
|
||||
{
|
||||
param (
|
||||
[string]$sourceDir,
|
||||
[Parameter(Mandatory=$false)][string]$destinationDir,
|
||||
[string]$source,
|
||||
[Parameter(Mandatory=$false)][string]$destination,
|
||||
[Parameter(Mandatory=$false)][string]$fileExt
|
||||
)
|
||||
|
||||
# Ensure the destination directory exists
|
||||
if ($destinationDir -and (-not (Test-Path $destinationDir)))
|
||||
if ($destination -and (-not (Test-Path $destination)))
|
||||
{
|
||||
Write-Host "Creating destination directory $destinationDir..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destinationDir | Out-Null
|
||||
Write-Host "Creating destination directory $destination..." -ForegroundColor Cyan
|
||||
New-Item -ItemType Directory -Path $destination | Out-Null
|
||||
}
|
||||
|
||||
# Create temporary directory for curl
|
||||
$appname = $sourceDir.Split('\')[-1]
|
||||
$appname = $source.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 $sourceDir -Filter '*.url'
|
||||
$urlFiles = Get-ChildItem -Path $source -Filter '*.url'
|
||||
|
||||
foreach ($file in $urlFiles)
|
||||
{
|
||||
$url = Get-Content $file.FullName
|
||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||
$destinationPath = "$destinationDir\$fileName"
|
||||
$destinationPath = "$destination\$fileName"
|
||||
|
||||
if (-not ($url -match 'git@|https://.*\.git'))
|
||||
{
|
||||
@ -115,11 +116,11 @@ function ProcessUrlFiles
|
||||
$extension = $fileExt
|
||||
$url += $fileExt
|
||||
}
|
||||
$destinationPath = "$destinationDir\$fileName$extension"
|
||||
$destinationPath = "$destination\$fileName$extension"
|
||||
|
||||
# Respond only if destination is provided
|
||||
$conditional = " to $destinationPath"
|
||||
if (-not $destinationDir)
|
||||
if (-not $destination)
|
||||
{ $conditional = ''
|
||||
}
|
||||
|
||||
@ -128,14 +129,14 @@ function ProcessUrlFiles
|
||||
$tmpDestination = "$tmpApp\$fileName$extension"
|
||||
|
||||
# Copy only if destination is provided
|
||||
if ($destinationDir)
|
||||
if ($destination)
|
||||
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
# Use $tmpApp as destination in case of git repo
|
||||
if (-not $destinationDir)
|
||||
if (-not $destination)
|
||||
{ $destinationPath = "$tmpApp\$fileName"
|
||||
}
|
||||
|
||||
@ -150,7 +151,7 @@ function ProcessUrlFiles
|
||||
Write-Host "Cloning $fileName from $url to $destinationPath..." -ForegroundColor Cyan
|
||||
git clone $url $destinationPath
|
||||
}
|
||||
Set-Location -
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Function to expand zip archives and copy to destination paths
|
||||
@ -174,7 +175,7 @@ function UnzipAndInstall
|
||||
{
|
||||
$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
|
||||
Expand-Archive "$tmpApp\$fileName.zip" -DestinationPath "$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
|
||||
|
11
util/winget.list
Normal file
11
util/winget.list
Normal file
@ -0,0 +1,11 @@
|
||||
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
|
29
util/winget.psm1
Normal file
29
util/winget.psm1
Normal file
@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
14
util/wsl.list
Normal file
14
util/wsl.list
Normal file
@ -0,0 +1,14 @@
|
||||
make
|
||||
gcc
|
||||
ripgrep
|
||||
unzip
|
||||
git
|
||||
xclip
|
||||
python3
|
||||
python3-venv
|
||||
composer
|
||||
luarocks
|
||||
fd-find
|
||||
python3-pip
|
||||
python3-pynvim
|
||||
openjdk-21-jdk-headless
|
60
util/wsl.psm1
Normal file
60
util/wsl.psm1
Normal file
@ -0,0 +1,60 @@
|
||||
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