-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·215 lines (185 loc) · 6.83 KB
/
setup
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/env python3
# TODO: Setup real programmers dvorak to be installed too
import os
from dataclasses import dataclass
@dataclass
class Repos:
name: str
repo: str
bare_checkout: bool
personal: bool
@dataclass
class SoftwareRepo:
name: str
repo: str
@dataclass
class Package:
package: str
aur: bool
def git_command(repo: str, bare_checkout: bool, name: str, personal_or_work: str) -> str:
if bare_checkout:
return f"git clone --bare {repo} /home/sky/{personal_or_work}/{name}"
return f"git clone {repo} /home/sky/{personal_or_work}/{name}"
def install_repo(repo: str, personal: bool, bare_checkout: bool, name: str):
if personal:
os.system(git_command(repo, bare_checkout, name, "personal"))
else:
os.system(git_command(repo, bare_checkout, name, "work"))
def install_software_repo(repo: str, name: str):
os.system(f"git clone {repo} /home/sky/.local/src/{name}")
def setup_folders():
dirs = [
"/home/sky/.local/src/",
"/home/sky/personal/",
"/home/sky/work/",
"/home/sky/Pictures/",
"/home/sky/Pictures/Captures/",
"/home/sky/Videos/",
"/home/sky/Downloads/",
"/home/sky/Documents/",
]
for dir in dirs:
os.makedirs(dir)
def install_package(package: str, aur: bool):
if aur:
os.system(f"sudo yay --noconfirm --needed -S {package}")
else:
os.system(f"sudo pacman --noconfirm --needed -S {package}")
def compile_program(path: str):
os.system(f"cd {path} && sudo make && sudo make install")
def main():
print("This will make changes to your system.")
print("The script asumes your home dir is under the user sky.\nIf it's not make sure to change the username in the script.")
should_continue = input("Continue the install? (y/n) ")
if should_continue == "n":
exit()
setup_folders()
os.system("sudo pacman --noconfirm -Syyu")
# Make pacman colorful, concurrent downloads and Pacman eye-candy.
os.system("sudo grep -q 'ILoveCandy' /etc/pacman.conf || sed -i '/#VerbosePkgLists/a ILoveCandy' /etc/pacman.conf")
os.system("sudo sed -Ei 's/^#(ParallelDownloads).*/\1 = 5/;/^#Color$/s/#//' /etc/pacman.conf")
# Use all cores when compling things with make
os.system("sudo sed -i 's/-j2/-j$(nproc)/;/^#MAKEFLAGS/s/^#//' /etc/makepkg.conf")
repos: list[Repos] = [
# Personal
Repos("control-aircon", "[email protected]:skykosiner/dakin-aircon-golang", False, True),
Repos("control-lights", "[email protected]:skykosiner/control-hue-light-golang", False, True),
Repos("control-website", "[email protected]:skykosiner/control-website", True, True),
Repos("file-browser", "[email protected]:skykosiner/file-browser",False, True),
Repos("skykosiner-com", "[email protected]:skykosiner/skykosiner-com", True, True),
Repos("statusline.nvim", "[email protected]:skykosiner/statusline.nvim", False, True),
Repos("todoist-cli", "[email protected]:skykosiner/todoist-cli", False, True),
Repos("todoist.nvim", "[email protected]:skykosiner/todoist.nvim", False, True),
# Work
Repos("dish-diaries", "[email protected]:skykosiner/dish-diaries", True, False),
]
for repo in repos:
install_repo(repo.repo, repo.personal, repo.bare_checkout, repo.name)
software_repo: list[SoftwareRepo] = [
SoftwareRepo("dmenu", "[email protected]:skykosiner/dmenu"),
SoftwareRepo("dwmblocks", "[email protected]:skykosiner/dwmblocks"),
SoftwareRepo("dwm", "[email protected]:skykosiner/dwm"),
SoftwareRepo("neovim", "[email protected]:neovim/neovim"),
SoftwareRepo("st", "[email protected]:skykosiner/st"),
SoftwareRepo("yay", "[email protected]:jguer/yay"),
]
for repo in software_repo:
install_software_repo(repo.repo, repo.name)
# Compile programs
compile_program("/home/sky/.local/src/neovim")
compile_program("/home/sky/.local/src/dmenu")
compile_program("/home/sky/.local/src/dmenu")
os.system("cd /home/sky/.local/src/yay && makepkg --noconfirm -si")
packages: list[Package] = [
# Packaman packages
Package("arandr", False),
Package("bat", False),
Package("bc", False),
Package("btop", False),
Package("cmake", False),
Package("cmatrix", False),
Package("cowsay", False),
Package("crontab", False),
Package("droidcam", False),
Package("dunst", False),
Package("ffmpeg", False),
Package("ffmpegthumbnailer", False),
Package("flameshot", False),
Package("fzf", False),
Package("gimp", False),
Package("pcmanfm", False),
Package("thunar", False),
Package("git", False),
Package("github-cli", False),
Package("go", False),
Package("htop", False),
Package("kitty", False),
Package("lf", False),
Package("lolcat", False),
Package("lynx", False),
Package("man", False),
Package("mpv", False),
Package("npm", False),
Package("obs-studio", False),
Package("picom", False),
Package("pulsemixer", False),
Package("python-dbus", False),
Package("python-pip", False),
Package("qbittorent", False),
Package("ripgrep", False),
Package("rsync", False),
Package("rust", False),
Package("spotify-launcher", False),
Package("stow", False),
Package("sxiv", False),
Package("tldr", False),
Package("tree-sitter", False),
Package("tree-sitter-cli", False),
Package("tmux", False),
Package("tor", False),
Package("ueberzug", False),
Package("vim", False),
Package("wezterm", False),
Package("xclip", False),
Package("xorg-xkill", False),
Package("zathura", False),
Package("zathura-pdf-mupdf", False),
Package("zoxide", False),
# aur packages
Package("authy", True),
Package("brave-bin", True),
Package("droidcam", True),
Package("netlify", True),
Package("obsidian", True),
Package("unimatrix", True),
Package("zsh-autosuggestions-git", True),
Package("zsh-syntax-highlighting-git", True),
]
for package in packages:
install_package(package.package, package.aur)
# Install a few other bits
os.system("cargo install starship")
dotfiles_to_stow = [
"aircon",
"alacritty",
"bin",
"dunst",
"fonts",
"i3",
"kitty",
"lf",
"mpv",
"nvim",
"shell",
"starship",
"sxhkd",
"sxiv",
"tmux",
"tree-sitter",
"vim",
"zsh",
]
for dotfile in dotfiles_to_stow:
os.system(f"cd /home/sky/.dotfiles/ && stow {dotfile}")
if __name__ == "__main__":
main()