-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.ps1
76 lines (64 loc) · 2.2 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
function Symlink([string] $target, [string] $link)
{
$file = Get-Item $link -Force -ErrorAction SilentlyContinue
$exists = [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
if($file.PSIsContainer -and !$exists)
{
Remove-Item -Recurse -Force -Path $link
}
if(!$exists)
{
Write-Host "Creating link from '$target' to '$link'"
New-Item -ItemType SymbolicLink -Force -Target "$target" -Path "$link" > $null
}
}
function SymlinkDirectory([string] $target, [string] $link)
{
$file = Get-Item $link -Force -ErrorAction SilentlyContinue
$exists = [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
if(!$exists)
{
Write-Host "Creating link from '$target' to '$link'"
New-Item -ItemType SymbolicLink -Force -Target "$target" -Path "$link" > $null
}
}
function ChocoInstall([string] $package, [string] $executable)
{
$has_choco = Get-Command -Name choco.exe -ErrorAction SilentlyContinue
if(!$has_choco)
{
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
if($executable -eq '')
{
$executable = $package
}
$has_package = Get-Command -Name "$executable" -ErrorAction SilentlyContinue
if(!$has_package)
{
choco install -y "$package"
}
}
Symlink "$PSScriptRoot\profile.ps1" "$profile"
Symlink "$PSScriptRoot\nvim" "$env:LOCALAPPDATA\nvim";
Symlink "$PSScriptRoot\ideavimrc" "$env:USERPROFILE\.ideavimrc"
ChocoInstall "7zip" "7z"
ChocoInstall "bat"
ChocoInstall "curl"
ChocoInstall "fd"
ChocoInstall "fzf"
ChocoInstall "git"
ChocoInstall "golang" "go"
ChocoInstall "make"
ChocoInstall "microsoft-windows-terminal" "wt"
ChocoInstall "neovide"
ChocoInstall "nerd-fonts-noto"
ChocoInstall "nodejs" "npm"
ChocoInstall "powertoys"
ChocoInstall "python3-virtualenv" "virtualenv"
ChocoInstall "pwsh"
ChocoInstall "ripgrep" "rg"
ChocoInstall "zig"
git config --global push.autoSetupRemote true
Write-Host "Done"