From 1a7e3549eb97b31f4d24bb41157a9dd78eeb17e5 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Wed, 11 Feb 2026 01:38:24 -0700 Subject: [PATCH] Added makefile :) --- Makefile | 23 +++++++++++++++++++++++ configuration.nix | 1 + 2 files changed, 24 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0367f05 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.PHONY: help certs matrix-user switch + +help: ## Show this help + @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' + +switch: ## Rebuild and switch NixOS configuration + sudo nixos-rebuild switch --flake .#haschel + +certs: ## Renew certs for any hosts that don't have a cert yet + @for unit in $$(systemctl list-units 'acme-order-renew-*' --all --plain --no-legend --state=inactive --state=failed | awk '{print $$1}'); do \ + domain=$$(echo "$$unit" | sed 's/acme-order-renew-//;s/\.service//'); \ + if [ ! -f "/var/lib/acme/$$domain/fullchain.pem" ]; then \ + echo "Requesting cert for $$domain..."; \ + sudo systemctl start "$$unit" & \ + fi; \ + done; \ + wait; \ + echo "Done. Check status with: systemctl list-units 'acme-order-renew-*' --all --state=failed" + +matrix-user: ## Register a new Matrix user interactively + @nix shell nixpkgs#matrix-synapse -c register_new_matrix_user \ + -k "$$(sudo cat /var/lib/matrix-synapse/registration_shared_secret)" \ + http://localhost:8008 diff --git a/configuration.nix b/configuration.nix index eb66bc8..7a9a05e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -17,6 +17,7 @@ environment.systemPackages = with pkgs; [ git + gnumake openssl ];