aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 56ffccb6e35f6f4c8e748185e519dc325c6449f6 (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
67
68
69
70
71
72
73
74
75
REPO_CHANGES := $(shell git status --porcelain | wc -l)
IS_FEDORA := $(shell command -v dnf > /dev/null && test -f /etc/fedora-release; echo $$?)

include environment.mk

.PHONY: console
console:
ifneq ($(REPO_CHANGES),0)
	$(error will not run with a dirty repo. stash or commit changes, or re-run forcing REPO_CHANGES=0.)
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
	mkdir -p ${HOME}/.local/share/zsh
	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 sway-config-fedora blueman
endif

.PHONY: fedora
fedora: console
ifneq ($(IS_FEDORA),0)
	$(warning not fedora workstation, skipping.)
else
ifeq ($(COMPUTER_IDENTITY),desktop)
	ln -sfr stow/swaylock/.config/swaylock/config.4k stow/swaylock/.config/swaylock/config
	ln -sfr stow/foot/.config/foot/foot.4k.ini stow/foot/.config/foot/foot-environment.ini
	ln -sfr stow/waybar/.config/waybar/config.4k stow/waybar/.config/waybar/config
else
	ln -sfr stow/swaylock/.config/swaylock/config.1k stow/swaylock/.config/swaylock/config
	ln -sfr stow/foot/.config/foot/foot.1k.ini stow/foot/.config/foot/foot-environment.ini
	ln -sfr stow/waybar/.config/waybar/config.1k stow/waybar/.config/waybar/config
endif
	stow --adopt --dir=stow --target=$(HOME) foot
	stow --adopt --dir=stow --target=$(HOME) mako
	stow --adopt --dir=stow --target=$(HOME) rofi
	stow --adopt --dir=stow --target=$(HOME) sway
	stow --adopt --dir=stow --target=$(HOME) swaylock
	stow --adopt --dir=stow --target=$(HOME) udiskie
	stow --adopt --dir=stow --target=$(HOME) waybar
	stow --adopt --dir=stow --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.timer
	mkdir -p ${HOME}/.local/share/backgrounds
	ln -sf /usr/share/backgrounds/default.png ${HOME}/.local/share/backgrounds/default
	ln -sf /usr/share/backgrounds/default.png ${HOME}/.local/share/backgrounds/locked
endif

.PHONY: restore
restore:
	git restore stow