commit cb1263100f4f0e7f587b3b0648eb49a2c03f4480
parent 6d301982fd6a0429c6785cf297bb8a8a3177105a
Author: Silas Brack <silasbrack@gmail.com>
Date: Wed, 8 Jan 2025 21:10:21 +0100
chore: clean up more
Diffstat:
5 files changed, 77 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,74 @@
+.PHONY: shell vm deploy
+
+## Open the development environment
+shell:
+ nix develop
+
+## Spin up a VM locally to test the application
+vm:
+ nixos-shell --flake .
+
+## Deploy configuration to production server
+deploy:
+ nixos-rebuild test --fast --flake .#nixos-s-1vcpu-512mb-10gb-ams3-01 --target-host root@188.166.127.72
+
+#################################################################################
+# Self Documenting Commands #
+#################################################################################
+
+.DEFAULT_GOAL := help
+
+# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
+# sed script explained:
+# /^##/:
+# * save line in hold space
+# * purge line
+# * Loop:
+# * append newline + line to hold space
+# * go to next line
+# * if line starts with doc comment, strip comment character off and loop
+# * remove target prerequisites
+# * append hold space (+ newline) to line
+# * replace newline plus comments by `---`
+# * print line
+# Separate expressions are necessary because labels cannot be delimited by
+# semicolon; see <http://stackoverflow.com/a/11799865/1968>
+.PHONY: help
+help:
+ @echo "$$(tput bold)Available rules:$$(tput sgr0)"
+ @echo
+ @sed -n -e "/^## / { \
+ h; \
+ s/.*//; \
+ :doc" \
+ -e "H; \
+ n; \
+ s/^## //; \
+ t doc" \
+ -e "s/:.*//; \
+ G; \
+ s/\\n## /---/; \
+ s/\\n/ /g; \
+ p; \
+ }" ${MAKEFILE_LIST} \
+ | LC_ALL='C' sort --ignore-case \
+ | awk -F '---' \
+ -v ncol=$$(tput cols) \
+ -v indent=19 \
+ -v col_on="$$(tput setaf 6)" \
+ -v col_off="$$(tput sgr0)" \
+ '{ \
+ printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
+ n = split($$2, words, " "); \
+ line_length = ncol - indent; \
+ for (i = 1; i <= n; i++) { \
+ line_length -= length(words[i]) + 1; \
+ if (line_length <= 0) { \
+ line_length = ncol - indent - length(words[i]) - 1; \
+ printf "\n%*s ", -indent, " "; \
+ } \
+ printf "%s ", words[i]; \
+ } \
+ printf "\n"; \
+ }' \
+ | more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
diff --git a/README.md b/README.md
@@ -1,5 +1,2 @@
# My Project
-- `nix develop`
-- `nixos-shell --flake .`
-- `nixos-rebuild test --fast --flake .#nixos-s-1vcpu-512mb-10gb-ams3-01 --target-host root@188.166.127.72`
diff --git a/docs/todo.md b/docs/todo.md
@@ -0,0 +1,3 @@
+# Todo
+- [ ] Fix compilation of pc in rebar3 such that we provide pc instead of having it download it from the web, for which we need to disable sandbox
+
diff --git a/flake.lock b/flake.lock
@@ -134,22 +134,6 @@
"type": "github"
}
},
- "nixpkgs_24_11": {
- "locked": {
- "lastModified": 1736200483,
- "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixos-24.11",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
"nixpkgs_3": {
"locked": {
"lastModified": 1730531603,
@@ -188,7 +172,6 @@
"nixos-shell": "nixos-shell",
"nixpkgs": "nixpkgs_3",
"nixpkgs_24_05": "nixpkgs_24_05",
- "nixpkgs_24_11": "nixpkgs_24_11",
"sops-nix": "sops-nix"
}
},
diff --git a/flake.nix b/flake.nix
@@ -1,7 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
- nixpkgs_24_11.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs_24_05.url = "github:NixOS/nixpkgs/nixos-24.05";
nixos-shell.url = "github:Mic92/nixos-shell";
sops-nix.url = "github:Mic92/sops-nix";