aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 6f6fc48d296f550d0014bbab17d4c3710cb422b2 (plain)
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
REPO_CHANGES := $(shell git status --porcelain | wc -l)
DEV_MODE := 0
IS_FEDORA := $(shell command -v dnf > /dev/null && test -f /etc/fedora-release; echo $$?)

.PHONY: .initialize
.initialize:
ifneq ($(REPO_CHANGES),0)
ifeq ($(DEV_MODE),0)
	$(error will not run with a dirty repo. stash or commit changes, or re-run with DEV_MODE=1.)
endif
endif
	git submodule update --init --recursive
	cp --update=none local/vimrc-local stow/vim/.vimrc-local
	cp --update=none local/gitconfig-local stow/git/.config/git/config-local
	cp --update=none local/local.zsh stow/zsh/.config/zsh/00-local.zsh

.PHONY: console
console: .initialize
	stow --adopt --dir=stow --target=$(HOME) console-utils
	stow --adopt --dir=stow --target=$(HOME) dircolors
	stow --adopt --dir=stow --target=$(HOME) git
	stow --adopt --dir=stow --target=$(HOME) vim
	stow --adopt --dir=stow --target=$(HOME) zsh

.PHONY: fedora-packages
fedora-packages:
ifneq ($(IS_FEDORA),0)
	$(warning not fedora workstation, skipping.)
else
	sudo dnf install \
		"https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(shell rpm -E %fedora).noarch.rpm" \
		"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(shell rpm -E %fedora).noarch.rpm"
	sudo dnf install \
		sway waybar rofi-wayland foot mako intel-one-mono-fonts \
		udiskie libappindicator-gtk3 python3-b2sdk pass passmenu \
		vlc unzip vim wget git zsh stow dnf-automatic \
		grimshot pulseaudio-utils thunar pavucontrol-qt \
		network-manager-applet
endif

.PHONY: fedora
fedora: console
ifneq ($(IS_FEDORA),0)
	$(warning not fedora workstation, skipping.)
else
	stow --adopt --dir=sway-de --target=$(HOME) foot
	stow --adopt --dir=sway-de --target=$(HOME) mako
	stow --adopt --dir=sway-de --target=$(HOME) rofi
	stow --adopt --dir=sway-de --target=$(HOME) sway
	stow --adopt --dir=sway-de --target=$(HOME) swaylock
	stow --adopt --dir=sway-de --target=$(HOME) udiskie
	stow --adopt --dir=sway-de --target=$(HOME) waybar
	stow --adopt --dir=sway-de --target=$(HOME) xdg-names
ifeq ($(shell systemctl --user is-active sway-session.target),active)
	systemctl --user enable --now udiskie.service
	systemctl --user enable --now xdg-names.service
else
	systemctl --user enable udiskie.service
	systemctl --user enable xdg-names.service
endif
	sudo systemctl enable --now dnf-automatic-install.timer
endif

.PHONY: restore
restore:
	git restore stow sway-de