2024-02-18 23:08:50 +03:00
|
|
|
NIX_RUN := nix run .\#
|
2022-11-30 23:38:47 +03:00
|
|
|
NIX_LOCK := nix flake lock
|
|
|
|
|
2024-05-20 18:45:12 +03:00
|
|
|
DEPS_EDITOR := \
|
2024-05-10 02:41:24 +03:00
|
|
|
nixeovim
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2024-05-20 18:45:12 +03:00
|
|
|
DEPS_SYSTEM := \
|
2022-11-30 23:38:47 +03:00
|
|
|
nixpkgs \
|
2023-03-31 17:40:22 +03:00
|
|
|
nixpkgs-unstable \
|
2022-11-30 23:38:47 +03:00
|
|
|
hardware \
|
|
|
|
home-manager \
|
2024-05-20 18:45:12 +03:00
|
|
|
agenix \
|
2022-11-30 23:38:47 +03:00
|
|
|
wired \
|
2024-03-28 15:16:04 +03:00
|
|
|
nil
|
2022-11-30 23:38:47 +03:00
|
|
|
|
|
|
|
MACHINES := \
|
|
|
|
home \
|
|
|
|
asus-gl553vd
|
|
|
|
|
|
|
|
VPS := \
|
2023-07-29 17:21:48 +03:00
|
|
|
istal \
|
|
|
|
tatos
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: help
|
2022-11-30 23:38:47 +03:00
|
|
|
help:
|
2023-11-24 01:19:13 +03:00
|
|
|
bat -p Makefile
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
################################################################################
|
|
|
|
# Hosts
|
|
|
|
################################################################################
|
|
|
|
|
2022-11-30 23:38:47 +03:00
|
|
|
define machine_rule
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: $(1)
|
2023-01-04 23:43:54 +03:00
|
|
|
$(1): ;
|
2024-05-26 00:21:41 +03:00
|
|
|
# systemctl --user reset-failed
|
2024-04-16 13:14:23 +03:00
|
|
|
sudo nix run $(NIX_ARGS) .#switch/$(1) -- $(BUILD_ARGS)
|
2022-11-30 23:38:47 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define vps_rule
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: $(1)
|
2024-04-16 13:14:23 +03:00
|
|
|
$(1): ; nix run .#deploy/$(1) -- $(BUILD_ARGS)
|
|
|
|
|
2022-11-30 23:38:47 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach machine,$(MACHINES),$(eval $(call machine_rule,$(machine))))
|
|
|
|
$(foreach vps,$(VPS),$(eval $(call vps_rule,$(vps))))
|
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
.PHONY: rollback
|
|
|
|
rollback:
|
2024-05-26 00:21:41 +03:00
|
|
|
sudo nixos-rebuild switch --rollback
|
2024-03-29 18:27:33 +03:00
|
|
|
|
2024-05-21 01:15:30 +03:00
|
|
|
################################################################################
|
|
|
|
# Editor
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
.PHONY: neovim
|
|
|
|
neovim:
|
2024-05-22 15:06:46 +03:00
|
|
|
nix profile upgrade $(or $(NEOVIM_INDEX),$(shell nix profile list --json | jq '.elements | to_entries[] | select(.value.attrPath | endswith(".neovim-dev")) | .key'))
|
2024-05-21 01:15:30 +03:00
|
|
|
|
|
|
|
.PHONY: init-neovim
|
|
|
|
init-neovim:
|
|
|
|
nix profile install .#neovim-dev
|
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
################################################################################
|
|
|
|
# Deps
|
|
|
|
################################################################################
|
|
|
|
|
2024-05-22 15:13:40 +03:00
|
|
|
.PHONY: deps-editor
|
2024-05-20 18:45:12 +03:00
|
|
|
deps-editor:
|
|
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_EDITOR),--update-input $(dep))
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2024-05-22 15:13:40 +03:00
|
|
|
.PHONY: deps-system
|
2024-05-20 18:45:12 +03:00
|
|
|
deps-system:
|
|
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_SYSTEM),--update-input $(dep))
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
.PHONY: deps
|
2024-05-20 18:45:12 +03:00
|
|
|
deps: deps-editor deps-system ;
|
2024-03-29 18:27:33 +03:00
|
|
|
|