# nixos-rebuild runs as you and only uses sudo to activate: evaluation needs
# your SSH agent and config, because the ripdj input is fetched over SSH.
# The flake's hosts are named after the hostnames, so `--flake .` finds this one.

HOSTS = nixbook nixpad tuxcomp

# build this host's system and make a boot entry
boot:
	nixos-rebuild boot --flake . --sudo 

# build this host's system and switch in place
switch:
	nixos-rebuild switch --flake . --sudo

# build this host's system without activating it.
build:
	nixos-rebuild build --flake .

# evaluate every host.
test:
	@for host in $(HOSTS); do \
		echo "$$host"; \
		nix eval --show-trace --raw .#nixosConfigurations.$$host.config.system.build.toplevel.drvPath > /dev/null || exit 1; \
	done

update:
	nix flake update

.PHONY: switch build check update
