Add move-dotfiles-to-HOME task to makefile
This commit is contained in:
parent
b0997d6dcb
commit
f7be1b4c70
9
Makefile
9
Makefile
|
@ -1,5 +1,6 @@
|
|||
USER := hlissner
|
||||
HOST := kuro
|
||||
HOME := /home/$(USER)
|
||||
|
||||
NIXOS_VERSION := 20.03
|
||||
NIXOS_PREFIX := $(PREFIX)/etc/nixos
|
||||
|
@ -13,7 +14,7 @@ FLAGS := -I "config=$$(pwd)/config" \
|
|||
all: channels
|
||||
@sudo nixos-rebuild $(FLAGS) $(COMMAND)
|
||||
|
||||
install: channels update config
|
||||
install: channels update config move_to_home
|
||||
@sudo nixos-install --root "$(PREFIX)" $(FLAGS)
|
||||
|
||||
upgrade: update switch
|
||||
|
@ -48,6 +49,7 @@ clean:
|
|||
|
||||
# Parts
|
||||
config: $(NIXOS_PREFIX)/configuration.nix
|
||||
move_to_home: $(NIXOS_PREFIX)/configuration.nix
|
||||
|
||||
channels:
|
||||
@sudo nix-channel --add "https://nixos.org/channels/nixos-${NIXOS_VERSION}" nixos
|
||||
|
@ -59,6 +61,11 @@ $(NIXOS_PREFIX)/configuration.nix:
|
|||
@echo "import /etc/dotfiles \"$${HOST:-$$(hostname)}\" \"$$USER\"" | sudo tee "$(NIXOS_PREFIX)/configuration.nix"
|
||||
@[ -f machines/$(HOST).nix ] || echo "WARNING: hosts/$(HOST)/default.nix does not exist"
|
||||
|
||||
$(HOME)/.dotfiles:
|
||||
@mkdir -p $(HOME)
|
||||
@[ -e $(HOME)/.dotfiles ] || sudo mv /etc/dotfiles $(HOME)/.dotfiles
|
||||
@[ -e /etc/dotfiles ] || sudo ln -s $(HOME)/.dotfiles /etc/dotfiles
|
||||
@chown $(USER):users $(HOME) $(HOME)/.dotfiles
|
||||
|
||||
# Convenience aliases
|
||||
i: install
|
||||
|
|
Loading…
Reference in a new issue