-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (98 loc) · 4.06 KB
/
Makefile
File metadata and controls
113 lines (98 loc) · 4.06 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
DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SYS=$(shell uname -a | cut -d ' ' -f 1)
CONFIG_HOME := ~/.config
LOCAL_BIN := ~/.local/bin
SYS_BIN := /usr/local/bin
USER_SYSTEMD := $(CONFIG_HOME)/systemd/user
SYS_SYSTEMD := /etc/systemd/system
.PHONY: linux symlinks linux-scripts systemd user-systemd-all system-systemd-all
linux: symlinks systemd
symlinks:
ln -nsf $(DIR)/aerc ~/.config/aerc
ln -nsf $(DIR)/alacritty ~/.config/alacritty
ln -nsf $(DIR)/emacs ~/.emacs.d
ln -nsf $(DIR)/ghostty ~/.config/ghostty
ln -nsf $(DIR)/haskell/ghci.conf ~/.ghc/ghci.conf
ln -nsf $(DIR)/helix ~/.config/helix
ln -nsf $(DIR)/jj ~/.config/jj
ln -nsf $(DIR)/jrnl ~/.config/jrnl
ln -nsf $(DIR)/khal ~/.config/khal
ln -nsf $(DIR)/khard ~/.config/khard
ln -nsf $(DIR)/kitty ~/.config/kitty
ln -nsf $(DIR)/neovim ~/.config/nvim
ln -nsf $(DIR)/ranger ~/.config/ranger
ln -nsf $(DIR)/todoman ~/.config/todoman
ln -nsf $(DIR)/tmux ~/.tmux
ln -nsf $(DIR)/tmux/tmux.conf ~/.tmux.conf
ln -nsf $(DIR)/yazi ~/.config/yazi
ln -nsf $(DIR)/zsh ~/.config/zsh
ln -sf $(DIR)/editorconfig ~/.editorconfig
ln -sf $(DIR)/eslintrc ~/.eslintrc
ln -sf $(DIR)/git/gitconfig ~/.gitconfig
ln -sf $(DIR)/git/gitignore_globals ~/.gitignore_globals
ln -sf $(DIR)/psql/psqlrc ~/.psqlrc
ln -sf $(DIR)/task/taskrc ~/.taskrc
ln -sf $(DIR)/zsh/zshenv ~/.zshenv
ifeq ($(SYS), Linux)
ln -nsf $(DIR)/dunst ~/.config/dunst
ln -nsf $(DIR)/i3 ~/.config/i3
ln -nsf $(DIR)/picom ~/.config/picom
ln -nsf $(DIR)/polybar ~/.config/polybar
ln -nsf $(DIR)/rofi ~/.config/rofi
ln -nsf $(DIR)/vdirsyncer ~/.config/vdirsyncer
ln -nsf ${DIR}/firejail ~/.config/firejail
ln -nsf ${DIR}/fontconfig ~/.config/fontconfig
ln -sf $(DIR)/xorg/XCompose ~/.XCompose
ln -sf $(DIR)/xorg/Xresources ~/.Xresources
ln -sf $(DIR)/xorg/xinitrc ~/.xinitrc
endif
$(USER_SYSTEMD):
mkdir -p $@
$(USER_SYSTEMD)/%: $(USER_SYSTEMD) $(DIR)/systemd/$(*)
ln -nsf $(DIR)/systemd/$(*) $(CONFIG_HOME)/systemd/user/$(*)
systemctl --user daemon-reload
systemctl --user enable $(*)
$(SYS_SYSTEMD):
mkdir -p $@
$(SYS_SYSTEMD)/%: $(SYS_SYSTEMD) $(DIR)/systemd/$(*)
sudo cp $(DIR)/systemd/$(*).{service,timer} /etc/systemd/system/
sudo systemctl enable $(*).service $(*).timer
sudo systemctl add-wants timers.target $(*).timer
sudo systemctl daemon-reload
sudo systemctl start timers.target
$(LOCAL_BIN):
mkdir -p $@
$(LOCAL_BIN)/%: $(LOCAL_BIN) $(DIR)/linux-scripts/user/$(*)
ln -nsf $(DIR)/linux-scripts/user/$(*) $(LOCAL_BIN)/$(*)
$(SYS_BIN):
sudo mkdir -p $@
$(SYS_BIN)/%: $(SYS_BIN) $(DIR)/linux-scripts/sys/$(*)
sudo ln -nsf $(DIR)/linux-scripts/sys/$(*) $(SYS_BIN)/$(*)
linux-scripts: $(LOCAL_BIN)/move-i3-workspace.sh \
$(LOCAL_BIN)/run-backup \
$(LOCAL_BIN)/restore-files \
$(LOCAL_BIN)/nextcloud-sync \
$(LOCAL_BIN)/email-sync \
$(SYS_BIN)/take-snapshot \
$(SYS_BIN)/mount-backup-drive
user-systemd-all: linux-scripts \
$(USER_SYSTEMD)/mbsync.service $(USER_SYSTEMD)/mbsync.timer \
$(USER_SYSTEMD)/vdirsyncer.service $(USER_SYSTEMD)/vdirsyncer.timer \
$(USER_SYSTEMD)/nextcloud-sync.service $(USER_SYSTEMD)/nextcloud-sync.timer \
$(USER_SYSTEMD)/duplicity.service $(USER_SYSTEMD)/duplicity.timer \
$(USER_SYSTEMD)/redshift-gtk.service \
$(USER_SYSTEMD)/dropbox.service \
$(USER_SYSTEMD)/playerctld.service \
$(USER_SYSTEMD)/ssh-agent.service \
$(USER_SYSTEMD)/keepassxc.service \
$(USER_SYSTEMD)/mullvad-vpn.service \
$(USER_SYSTEMD)/iwgtk-indicator.service \
$(USER_SYSTEMD)/x11-autostart.target
systemctl --user add-wants x11-autostart.target redshift-gtk.service
systemctl --user add-wants x11-autostart.target dropbox.service
systemctl --user add-wants x11-autostart.target keepassxc.service
systemctl --user add-wants x11-autostart.target mullvad-vpn.service
systemctl --user add-wants x11-autostart.target iwgtk-indicator.service
systemctl --user start mbsync.timer vdirsyncer.timer nextcloud-sync.timer duplicity.timer playerctld.service ssh-agent.service
system-systemd-all: linux-scripts $(SYS_SYSTEMD)/freshclam $(SYS_SYSTEMD)/backup-snapshots
systemd: user-systemd-all system-systemd-all