summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 6b86d4df7813c3e6eb6854b1297b71e1d9342792 (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
default: fantasy

serverId := 45474


deploy upload-iso: target := root@ni.i
format mount install: target := root@188.68.36.196
populate: target ?= root@ni.i

deploy install upload-iso: populate

deploy:
	ssh "$(target)" nixos-rebuild switch -I /root/config

install:
	ssh "$(target)" env NIXOS_CONFIG=/root/config/nixos-config \
		nixos-install -I /root/config

format mount upload-iso: populate
	ssh "$(target)" ni-$@

populate:
	rsync -Flprtvz --delete-excluded keys/ $(target):/root/keys
	rsync -Flprtvz --delete-excluded ./ $(target):/root/config/nixos-config
	rsync -Flprtvz --delete-excluded ~/stockholm/ $(target):/root/config/stockholm
	rsync -Flprtvz --delete-excluded --exclude /.git  /var/src/nixpkgs/ $(target):/root/config/nixpkgs

kvm-info:
	umask 0077; vcp kvmInformation $(serverId) > keys/kvm-info.json
	jq -r '.ftp | "machine \(.host) login \(.user) password \(.pass)"' \
		< keys/kvm-info.json \
		> keys/upload-iso.netrc