-
Notifications
You must be signed in to change notification settings - Fork 25
/
Setup.ps1
122 lines (106 loc) · 4.78 KB
/
Setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# ██╗ ██╗██╗███╗ ██╗██████╗ ██████╗ ████████╗███████╗
# ██║ ██║██║████╗ ██║██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝
# ██║ █╗ ██║██║██╔██╗ ██║██║ ██║██║ ██║ ██║ ███████╗
# ██║███╗██║██║██║╚██╗██║██║ ██║██║ ██║ ██║ ╚════██║
# ╚███╔███╔╝██║██║ ╚████║██████╔╝╚██████╔╝ ██║ ███████║
# ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
# Setup.ps1 - Scott McKendry
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Requires -RunAsAdministrator
#Requires -Version 7
# Linked Files (Destination => Source)
$symlinks = @{
$PROFILE.CurrentUserAllHosts = ".\Profile.ps1"
"$HOME\AppData\Local\nvim" = ".\nvim"
"$HOME\AppData\Local\fastfetch" = ".\fastfetch"
"$HOME\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" = ".\windowsterminal\settings.json"
"$HOME\.gitconfig" = ".\.gitconfig"
"$HOME\AppData\Roaming\lazygit" = ".\lazygit"
"$HOME\AppData\Roaming\AltSnap\AltSnap.ini" = ".\altsnap\AltSnap.ini"
"$ENV:PROGRAMFILES\WezTerm\wezterm_modules" = ".\wezterm\"
}
# Winget & choco dependencies
$wingetDeps = @(
"chocolatey.chocolatey"
"eza-community.eza"
"ezwinports.make"
"fastfetch-cli.fastfetch"
"gerardog.gsudo"
"git.git"
"github.cli"
"kitware.cmake"
"mbuilov.sed"
"microsoft.powershell"
"neovim.neovim"
"openjs.nodejs"
"starship.starship"
"task.task"
)
$chocoDeps = @(
"altsnap"
"bat"
"fd"
"fzf"
"gawk"
"lazygit"
"mingw"
"nerd-fonts-jetbrainsmono"
"ripgrep"
"sqlite"
"wezterm"
"zig"
"zoxide"
)
# PS Modules
$psModules = @(
"CompletionPredictor"
"PSScriptAnalyzer"
"ps-arch-wsl"
"ps-color-scripts"
)
# Set working directory
Set-Location $PSScriptRoot
[Environment]::CurrentDirectory = $PSScriptRoot
Write-Host "Installing missing dependencies..."
$installedWingetDeps = winget list | Out-String
foreach ($wingetDep in $wingetDeps) {
if ($installedWingetDeps -notmatch $wingetDep) {
winget install --id $wingetDep
}
}
# Path Refresh
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
$installedChocoDeps = (choco list --limit-output --id-only).Split("`n")
foreach ($chocoDep in $chocoDeps) {
if ($installedChocoDeps -notcontains $chocoDep) {
choco install $chocoDep -y
}
}
# Install PS Modules
foreach ($psModule in $psModules) {
if (!(Get-Module -ListAvailable -Name $psModule)) {
Install-Module -Name $psModule -Force -AcceptLicense -Scope CurrentUser
}
}
# Delete OOTB Nvim Shortcuts (including QT)
if (Test-Path "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Neovim\") {
Remove-Item "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Neovim\" -Recurse -Force
}
# Persist Environment Variables
[System.Environment]::SetEnvironmentVariable('WEZTERM_CONFIG_FILE', "$PSScriptRoot\wezterm\wezterm.lua", [System.EnvironmentVariableTarget]::User)
$currentGitEmail = (git config --global user.email)
$currentGitName = (git config --global user.name)
# Create Symbolic Links
Write-Host "Creating Symbolic Links..."
foreach ($symlink in $symlinks.GetEnumerator()) {
Get-Item -Path $symlink.Key -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType SymbolicLink -Path $symlink.Key -Target (Resolve-Path $symlink.Value) -Force | Out-Null
}
git config --global --unset user.email | Out-Null
git config --global --unset user.name | Out-Null
git config --global user.email $currentGitEmail | Out-Null
git config --global user.name $currentGitName | Out-Null
# Install bat themes
bat cache --clear
bat cache --build
.\altsnap\createTask.ps1 | Out-Null