35 lines
1.1 KiB
Makefile
35 lines
1.1 KiB
Makefile
IP ?=
|
|
HOST ?=
|
|
init:
|
|
ifeq ($(IP),)
|
|
$(error IP not set)
|
|
endif
|
|
ifeq ($(HOST),)
|
|
$(error HOST not set)
|
|
endif
|
|
nix run github:nix-community/nixos-anywhere -- --flake .#$(HOST) --generate-hardware-config nixos-generate-config ./hosts/$(HOST)/hardware-configuration.nix --target-host nixos@$(IP)
|
|
|
|
deploy:
|
|
# no impurity allowed
|
|
ifneq ($(shell git diff),)
|
|
git add .
|
|
git commit -m "auto commit on build" -m "`PAGER=cat git diff --name-only --cached`"
|
|
endif
|
|
# push flake config to a remote server(s)
|
|
nix run github:serokell/deploy-rs .
|
|
|
|
sops:
|
|
# For setting up a new host: to generate a sops key from an existing ssh key
|
|
# just run `cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age` and then add
|
|
# that to the .sops.yaml file
|
|
sops updatekeys secrets.yaml
|
|
|
|
.DEFAULT_GOAL := default
|
|
.PHONY: default deploy init sops
|
|
default:
|
|
# This is my tiny makefile to create new machines and update existing ones
|
|
# it requires you to have nix and sops installed to correctly setup a new
|
|
# system and nix to deploy to an existing one.
|
|
#
|
|
# I'm not using just cause I've already got make installed everywhere and I
|
|
# know how to use it.
|