Repository navigation
Expand file tree
/
Copy pathsetup.ps1
More file actions
131 lines (111 loc) · 9.87 KB
/
Copy pathsetup.ps1
File metadata and controls
131 lines (111 loc) · 9.87 KB
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
# Install PowerShell modules early to avoid https://github.com/badrelmers/RefrEnv/issues/9
# https://github.com/ralish/PSDotFiles
# https://github.com/RaphGL/tuckr https://github.com/RaphGL/Tuckr/issues/92
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
# https://github.com/dahlbyk/posh-git/issues/891
Install-Module -Name posh-git
# Installing my scoop and packages from it
irm get.scoop.sh | iex
'extras', 'games' | % { scoop bucket add $_ }
scoop bucket add bash "https://github.com/scillidan/scoop-bash"
scoop bucket add TXG0Fk3_Asterism "https://github.com/TXG0Fk3/Asterism"
scoop bucket add torokoshka-scoop "https://github.com/soredake/torokoshka-scoop"
# FFmpeg: workaround for https://github.com/microsoft/winget-cli/issues/3601 https://stackoverflow.com/questions/34491244/environment-variable-is-too-large-on-windows-10
scoop install refrenv bray-terminal syncthingtray windows-maintenance-tool
scoop hold syncthingtray
# Developer Mode is needed to create symlinks without admin rights
# NOTE: https://github.com/microsoft/winget-cli/issues/3601 https://github.com/microsoft/winget-cli/issues/361
gsudo reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
# Installing software
# TODO: winget is not installing fonts to $env:LOCALAPPDATA\Microsoft\Windows\Fonts, report
# https://github.com/microsoft/winget-cli/pull/6619
#winget source add --name winget-extras --type Microsoft.PreIndexed.Package --arg "https://winget.tplant.com.au/cache"
#winget install --force -h hack-nerd-font
winget install --no-upgrade -h --accept-package-agreements --accept-source-agreements --exact office WingetPathUpdater gsudo Stacher.Stacher yt-dlp-nightly Microsoft.Coreutils StefanSundin.Superf4 ente-auth openhashtab ayugram BillStewart.SyncthingWindowsSetup LocalSend.LocalSend topgrade-rs.topgrade uv telegram lycheeverse.lychee yt-dlp.FFmpeg itch.io taiga nomacs.nomacs dupeguru Bitwarden.Bitwarden file-converter openrgb google-play-games unifiedremote sandboxie-classic Mozilla.Firefox NTKERNEL.WireSockVPNClient Chocolatey.Chocolatey steam Ryochan7.DS4Windows AppWork.JDownloader google-drive gog Ollama.Ollama ggml.llamacpp wiztree mikf.gallery-dl eaapp protonvpn msedgeredirect afterburner rivatuner bcuninstaller everything shixinhuang99.Czkawka.Tauri.FFmpeg MoonshotAI.Kimi MiniMax.MiniMaxCode RamenSoftware.Windhawk ente-photos quickshare PowerSoftware.AnyBurn shinchiro.mpv Xanashi.Icaros ZhipuAI.ZCode HermannSchinagl.LinkShellExtension parsec codex volumelock syncplay warp Stretchly.Stretchly PSerban93.Achievements xp8k0hkjfrxgck 9nmqc2ssjx24 9n8g7tscl18r 9pm9dfqrdh3f xpfftq032ptphf 9p6k58ths811 xp99vr1bpsbqj2 xpfm11z0w10r7g xp8jrf5sxv03zm xpdp2qw12dfsfk xpdccppsk2xpqw xpdnx7g06blh2g 9nvjqjbdkn97 9nc73mjwhsww xpdc2rh70k22mn 9p8ltpgcbzxd 9plm9xgg6vks 9pmz94127m4g xpfm5p5kdwf0jp xp89dcgq3k6vld 9p4clt2rj1rs 9pc2t04g3v9c 9p78l5zxh06d qBittorrent.qBittorrent
# Interactive tor browser installation
# NOTE: install silently when https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/issues/41138 is implemented
winget install --no-upgrade --interactive --accept-package-agreements --accept-source-agreements --exact TorProject.TorBrowser
# https://github.com/microsoft/winget-pkgs/issues/106091 https://github.com/microsoft/vscode/issues/134470
# https://github.com/microsoft/vscode/blob/9d43b0751c91c909eee74ea96f765b1765487d7f/build/win32/code.iss#L81-L88
winget install --no-upgrade -h --accept-package-agreements --accept-source-agreements vscode --custom "/mergetasks='!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath'"
# https://github.com/SpotX-Official/SpotX
iex "& { $(iwr -useb 'https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/run.ps1') } -confirm_spoti_recomended_over -confirm_uninstall_ms_spoti -new_theme -topsearchbar -newFullscreenMode -podcasts_on -block_update_on -cache_limit 5000 -defender_exclusions_off"
# Chocolatey stuff
# https://github.com/shinchiro/mpv-winbuild-cmake/issues/317
# https://github.com/shinchiro/mpv-winbuild-cmake/issues/793
# https://github.com/mpv-player/mpv/issues/17121
# Moved to winget's shinchiro.mpv
# gsudo choco install -y mpvio.install
# Local models
ollama pull nomic-embed-text
ollama pull gemma4:31b-cloud
ollama pull nemotron-3-ultra:cloud
# Installing Hack font
# https://github.com/microsoft/winget-pkgs/issues/17547
oh-my-posh font install hack
# Installing python tools packages
# 'git+https://github.com/arecarn/dploy.git'
# 'git+https://github.com/iamkroot/trakt-scrobbler.git'
# 'trakt-scrobbler', 'dploy' | % { uv tool install $_ }
'shiradl' | % { uv tool install --managed-python $_ }
# https://github.com/iamkroot/trakt-scrobbler/issues/354
# uv tool install --managed-python --prerelease allow trakt-scrobbler
# uv tool install --managed-python 'git+https://github.com/iamkroot/trakt-scrobbler'
uv tool install --managed-python 'git+https://github.com/soredake/trakt-scrobbler@master'
# https://github.com/arecarn/dploy/pull/42
uv tool install --managed-python 'git+https://github.com/arecarn/dploy.git'
# Add uv bin dir to PATH
# TODO: request env refresh in powershell
uv tool update-shell
# Refreshing PATH env
# . "$HOME/refrenv.ps1"
refrenv.ps1
# Dotfiles preparations
# https://github.com/arecarn/dploy/issues/8
# NOTE: not needed after https://github.com/arecarn/dploy/pull/42
#New-Item -Path $env:APPDATA\trakt-scrobbler, $env:APPDATA\mpv\scripts -ItemType Directory -Force | Out-Null
# https://github.com/microsoft/terminal/issues/2933 https://github.com/microsoft/terminal/issues/14730 https://github.com/microsoft/terminal/issues/17455
Remove-Item -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json; New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json -Target $HOME\git\dotfiles_windows\dotfiles\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
# https://github.com/microsoft/intelligent-terminal
Remove-Item -Path $env:LOCALAPPDATA\Packages\Microsoft.IntelligentTerminal_8wekyb3d8bbwe\LocalState\settings.json; New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\Packages\Microsoft.IntelligentTerminal_8wekyb3d8bbwe\LocalState\settings.json -Target $HOME\git\dotfiles_windows\dotfiles\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
# Linking dotfiles
gsudo dploy stow --no-folding $HOME\git\dotfiles_windows\dotfiles $HOME
# mpv plugins installation
curl -L --create-dirs --remote-name-all --output-dir $env:APPDATA\mpv\scripts "https://codeberg.org/jouni/mpv_sponsorblock_minimal/raw/branch/master/sponsorblock_minimal.lua" "https://raw.githubusercontent.com/zenwarr/mpv-config/master/scripts/russian-layout-bindings.lua" "https://github.com/CogentRedTester/mpv-sub-select/raw/master/sub-select.lua" "https://raw.githubusercontent.com/d87/mpv-persist-properties/master/persist-properties.lua"
# TODO: rename script upstream to reload.lua
curl -L --create-dirs --remote-name-all --output $env:APPDATA\mpv\scripts\reload.lua "https://raw.githubusercontent.com/4e6/mpv-reload/refs/heads/master/main.lua"
# Misc
trakts autostart enable
# Set static IP
$env:currentNetworkInterfaceIndex = (Get-NetRoute | Where-Object { $_.DestinationPrefix -eq "0.0.0.0/0" -and $_.NextHop -like "192.168*" } | Get-NetAdapter | Where-Object { $_.Status -eq "Up" }).InterfaceIndex
gsudo {
# https://stackoverflow.com/a/53991926
New-NetIPAddress -InterfaceIndex $env:currentNetworkInterfaceIndex -IPAddress 192.168.0.145 -AddressFamily IPv4 -PrefixLength 24 -DefaultGateway 192.168.0.1
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 1.1.1.1, 1.0.0.1
}
# https://remontka.pro/wake-timers-windows/
# https://www.elevenforum.com/t/enable-or-disable-to-allow-wake-timers-in-windows-11.7010/
powercfg /SETDCVALUEINDEX SCHEME_CURRENT 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
powercfg /SETACVALUEINDEX SCHEME_CURRENT 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
# Various settings & tasks
gsudo {
# Disable hypervisor boot
# https://stackoverflow.com/a/35812945
# https://github.com/microsoft/WSL/issues/9695
# https://bytejams.com/help/hvci.html
# https://learn.microsoft.com/en-us/windows/security/hardware-security/enable-virtualization-based-protection-of-code-integrity?tabs=security
# https://learn.microsoft.com/en-us/windows/deployment/windows-autopatch/manage/windows-autopatch-hotpatch-updates
bcdedit /set hypervisorlaunchtype off
# Upgrade everything with topgrade task
Unregister-ScheduledTask -TaskName "Upgrade everything" -Confirm:$false
Register-ScheduledTask -Principal (New-ScheduledTaskPrincipal -UserID "$env:USERDOMAIN\$env:USERNAME" -RunLevel Highest) -Action (New-ScheduledTaskAction -Execute (where.exe /R "$env:LOCALAPPDATA\Microsoft\WindowsApps" pwsh.exe)[0] -Argument "-WindowStyle Minimized $HOME\git\dotfiles_windows\scripts\upgrade-all.ps1") -TaskName "Upgrade everything" -Settings (New-ScheduledTaskSettingsSet -StartWhenAvailable -RunOnlyIfNetworkAvailable) -Trigger (New-ScheduledTaskTrigger -Weekly -DaysOfWeek Friday -At 12:00)
}
# https://github.com/Jorman/Scripts?tab=readme-ov-file#addqbittorrenttrackerssh
# https://github.com/Jorman/Scripts/blob/master/AddqBittorrentTrackers/AddqBittorrentTrackers.sh.readme.md
git clone "https://github.com/Jorman/Scripts" "$HOME/git/Jorman-Scripts"
New-Item -ItemType Directory -Force -Path "$HOME/.local/bin" | Out-Null
(Get-Content "$HOME/git/Jorman-Scripts/AddqBittorrentTrackers/AddqBittorrentTrackers.py" -Raw) `
-replace 'qbt_host\s*=.*', 'qbt_host = "http://127.0.0.1"' `
-replace 'qbt_port\s*=.*', 'qbt_port = "8080"' `
-replace 'qbt_username\s*=.*', 'qbt_username = "admin"' `
-replace 'qbt_password\s*=.*', 'qbt_password = "adminadmin"' | Set-Content "$HOME/.local/bin/AddqBittorrentTrackers.py"