-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.ps1
183 lines (164 loc) · 5.15 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Need to run this as an administrator
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "You do not have Administrator rights. Run this script as Administrator."
Exit
}
$user = $env:USERNAME
Write-Host "Configuring Windows....."
$wingetDeps = @(
"chocolatey.chocolatey"
"eza-community.eza"
"github.cli"
"Git.Git"
"ezwinports.make"
"kitware.cmake"
"neovim.neovim"
"openjs.nodejs"
"Microsoft.PowerToys"
"Readdle.Spark"
"Microsoft.Sysinternals.ProcessExplorer"
"Microsoft.Sysinternals.ProcessMonitor"
"Microsoft.Sysinternals.TCPView"
"Mozilla.Firefox.DeveloperEdition"
"TorProject.TorBrowser"
"Rustlang.Rustup"
"Microsoft.VisualStudio.2022.Community"
"VideoLAN.VLC"
"Alacritty.Alacritty"
)
# Function to install packages from either Chocolatey or Scoop
# Installing Chocolatey
function Install-Chocolatey {
if (-Not (Get-Command choco -ErrorAction SilentlyContinue)) {
Write-Host "Installing Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
else {
Write-Host "Chocolatey is already installed."
}
}
# Installing Scoop
function Install-Scoop {
if (-Not (Get-Command scoop -ErrorAction SilentlyContinue)) {
Write-Host "Installing Scoop..."
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
}
else {
Write-Host "Scoop is already installed."
}
}
$choice = Read-Host "Choose a package manager: (1) Chocolatey (2) Scoop"
# $psModules = @(
# "CompletionPredictor"
# "PSScriptAnalyzer"
# "PSFzf"
# "posh-git"
# "Terminal-Icons"
# )
$code_extensions = @(
"formulahendry.auto-close-tag"
"formulahendry.auto-rename-tag"
"formulahendry.auto-complete-tag"
"aaron-bond.better-comments"
"antfu.icons-carbon"
"formulahendry.code-runner"
"vadimcn.vscode-lldb"
"naumovs.color-highlight"
"ms-azuretools.vscode-docker"
"editorconfig.editorconfig"
"usernamehw.errorlens"
"dsznajder.es7-react-js-snippets"
"dbaeumer.vscode-eslint"
"golang.go"
"kisstkondoros.vscode-gutter-preview"
"yzhang.markdown-all-in-one"
"pkief.material-icon-theme"
"christian-kohler.npm-intellisense"
"christian-kohler.path-intellisense"
"ms-vscode.powershell"
"esbenp.prettier-vscode"
"ms-python.python"
"rust-lang.rust-analyzer"
"redhat.vscode-yaml"
"twxs.cmake"
"BeardedBear.beardedtheme"
"reiisen.hi"
"Nur.just-black"
"sumneko.lua"
)
Set-Location $PSScriptRoot
[Environment]::CurrentDirectory = $PSScriptRoot
Write-Host -ForegroundColor Yellow "Installing the Winget dependencies"
$WingetAppsInstalled = winget list | Out-String
foreach ($wingetDep in $wingetDeps) {
winget install --id $wingetDep --disable-interactivity
}
# Path Refresh
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
switch ($choice) {
'1' {
Install-Chocolatey
$chocoDeps = @(
"bat"
"fd"
"ripgrep"
"lazygit"
"fzf"
"zoxide"
"sudo"
"mingw"
"jq"
)
Write-Host -ForegroundColor Yellow "Installing the Choco Dependencies"
$ChocoAppsInstalled = (choco list --limit-output --id-only).Split("`n")
foreach ($chocoDep in $chocoDeps) {
choco install $chocoDep -y
}
}
'2' {
Install-Scoop
$scoopDeps = @(
"sudo"
"nodejs"
"gcc"
"curl"
"wget"
"jq"
"oh-my-posh"
"fzf"
"cmake"
"make"
"python"
"go"
"docker"
"bat"
)
Write-Host -ForegroundColor Yellow "Installing the Scoop Dependencies"
foreach ($scoopDep in $scoopDeps) {
scoop install $scoopDep
}
}
}
Write-Host "Installing Visual Studio Code extensions"
foreach ($code_extension in $code_extensions) {
code --install-extension $code_extension
}
mkdir D:\Projects
mkdir ~\Documents\Powershell
mkdir ~\.config\powershell
Write-Host "Copying Files to the respective Directories"
Copy-Item $PSScriptRoot\powershell\user_profile.ps1 C:\Users\$user\.config\powershell\
Copy-Item $PSScriptRoot\powershell\Microsoft.PowerShell_profile.ps1 C:\Users\$user\Documents\Powershell\
# Copy-Item $PSScriptRoot\starship\starship.toml C:\Users\$user\.config\
Copy-Item $PSScriptRoot\wallpapers\ C:\Users\$user\Pictures\ -Recurse
Copy-Item $PSScriptRoot\nvim\ $env:LOCALAPPDATA -Recurse
Copy-Item $PSScriptRoot\code\settings.json C:\Users\$user\AppData\Roaming\Code\User\ -Recurse
Copy-Item $PSScriptRoot\code\keybindings.json C:\Users\$user\AppData\Roaming\Code\User\ -Recurse
Unblock-File -Path C:\Users\$user\.config\powershell\user_profile.ps1
Unblock-File -Path C:\Users\$user\Documents\Powershell\Microsoft.PowerShell_profile.ps1
# Write-Host -ForegroundColor Yellow "Installing PS Modules"
# foreach ($psModule in $psModules) {
# if (!(Get-Module -ListAvailable -Name $psModule)) {
# Install-Module -Name $psModule -Force -AcceptLicense -Scope CurrentUser
# }
# }