aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..da3a9ce
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+SERVERS := g1-bigscreen
+
+default: servers
+all: servers
+
+.PHONY: default all infra servers local dry-local
+
+# Servers
+servers: $(SERVERS)
+$(SERVERS): %:
+ rsync --delete -ravP --filter=':- .gitignore' --exclude='.git' . $@:/etc/nixos
+ rsync --delete -ravP state $@:/etc/nixos/
+ ssh -t $@ "tmux new-session -s rebuild 'cd /etc/nixos && rm -rf .git && nixos-rebuild switch --flake .; echo \"--- done ---\"; read;'"
+
+$(addprefix dry-,$(SERVERS)): %:
+ rsync --delete -ravP --filter=':- .gitignore' --exclude='.git' . ${subst dry-,,$@}:/etc/nixos/dry
+ rsync --delete -ravP state ${subst dry-,,$@}:/etc/nixos/dry
+ ssh -t ${subst dry-,,$@} "tmux new-session -s rebuild 'cd /etc/nixos/dry && rm -rf .git && nixos-rebuild dry-activate --flake .; echo \"--- done ---\"; read;'"
+
+$(addprefix vm-,$(SERVERS)): %:
+ nix build .#nixosConfigurations.${subst vm-,,$@}.config.system.build.vm
+ ./result/bin/run-${subst vm-,,$@}-vm
+
+$(addprefix build-,$(SERVERS)): %:
+ nix build .#nixosConfigurations.${subst build-,,$@}.config.system.build.toplevel
+$(addprefix tree-,$(SERVERS)): %:
+ nix build .#nixosConfigurations.${subst tree-,,$@}.config.system.build.toplevel
+ nix-tree ./result