Rework Makefile with install/link/update targets and auto-generation

Add gen-update-targets.sh to parse flake.nix and generate grouped
update targets (update-kyle, update-mc). Makefile now has install
(copy) and link (symlink) targets for rebuild-nixos. Also fix mc
flake input URLs to use /mc/ org path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 01:49:58 -07:00
parent c394eec89f
commit 74a79cd369
5 changed files with 75 additions and 33 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/result
/*-linux.tar.gz
/update-targets.mk

View File

@@ -1,12 +1,18 @@
BIN_DIR := ${HOME}/.local/bin
SCRIPTS := $(BIN_DIR)/rebuild-nixos
.PHONY: all
all: $(SCRIPTS)
.PHONY: install link update-targets
install: $(BIN_DIR)
cp script/rebuild-nixos $(BIN_DIR)/
chmod +x $(BIN_DIR)/rebuild-nixos
link: $(BIN_DIR)
ln -sf $(CURDIR)/script/rebuild-nixos $(BIN_DIR)/
$(BIN_DIR):
mkdir -p $(BIN_DIR)
$(BIN_DIR)/rebuild-nixos: script/rebuild-nixos
cp script/rebuild-nixos $(BIN_DIR)/
chmod +x $(BIN_DIR)/rebuild-nixos
update-targets.mk: flake.nix script/gen-update-targets.sh
script/gen-update-targets.sh > $@
-include update-targets.mk

46
flake.lock generated
View File

@@ -164,17 +164,17 @@
]
},
"locked": {
"lastModified": 1774588158,
"narHash": "sha256-CM0CyFJ/XtxZWDKtBSgf6thY4/NZR72y8Muy4SD9oAk=",
"lastModified": 1774593162,
"narHash": "sha256-jYcIAwdULM2O06rNerW3PGp+cOQKlvk2DjmgnmDxzP8=",
"ref": "refs/heads/master",
"rev": "dc1816b159cc5095b8ddd7c3f942626243c0878b",
"revCount": 27,
"rev": "a45ed03432096f04b0fb6fd410e76a61223f4228",
"revCount": 28,
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mc-proxy"
"url": "https://git@git.wntrmute.dev/mc/mc-proxy"
},
"original": {
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mc-proxy"
"url": "https://git@git.wntrmute.dev/mc/mc-proxy"
}
},
"mcdeploy": {
@@ -190,11 +190,11 @@
"rev": "9c016e54ecbc3546b189af935f27ca0ad461c14f",
"revCount": 4,
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcdeploy"
"url": "https://git@git.wntrmute.dev/mc/mcdeploy"
},
"original": {
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcdeploy"
"url": "https://git@git.wntrmute.dev/mc/mcdeploy"
}
},
"mcias": {
@@ -208,11 +208,11 @@
"rev": "9b521f3d999e8950c2268c2240c490f8509db60f",
"revCount": 95,
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcias.git"
"url": "https://git@git.wntrmute.dev/mc/mcias.git"
},
"original": {
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcias.git"
"url": "https://git@git.wntrmute.dev/mc/mcias.git"
}
},
"mcp": {
@@ -222,11 +222,11 @@
]
},
"locked": {
"lastModified": 1774590396,
"narHash": "sha256-FyQNU//OHqjsU7wqJt5iosxwjbQafpmTORNyq7k+t+I=",
"lastModified": 1774595952,
"narHash": "sha256-AlivqmqpRuCav0Eu7sEpGDg0pxMeC7rNVewxelHSKZI=",
"ref": "refs/heads/master",
"rev": "e18a3647bfbc1a8a452133f8617bec6105776485",
"revCount": 22,
"rev": "503c52dc269ca834b8b38d1a242ed48971ee17cb",
"revCount": 24,
"type": "git",
"url": "https://git@git.wntrmute.dev/mc/mcp"
},
@@ -242,17 +242,17 @@
]
},
"locked": {
"lastModified": 1774588281,
"narHash": "sha256-OAncdSzGgH7zcRaBwBSQMc8ofVMNrNlsnMwMounARa4=",
"lastModified": 1774593062,
"narHash": "sha256-Mwt4+JkGUyFiwjnLMJGrAA/n9950c3X/waV3DiUB3d4=",
"ref": "refs/heads/master",
"rev": "3d36c58d0d672745f34301515ca568466bfb37a6",
"revCount": 24,
"rev": "acc4851549a01642952314e03e4d8d91002f8824",
"revCount": 26,
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcr"
"url": "https://git@git.wntrmute.dev/mc/mcr"
},
"original": {
"type": "git",
"url": "https://git@git.wntrmute.dev/kyle/mcr"
"url": "https://git@git.wntrmute.dev/mc/mcr"
}
},
"nix-index-database": {
@@ -365,11 +365,11 @@
]
},
"locked": {
"lastModified": 1774551446,
"narHash": "sha256-dnX6zMTp4jqbcjlD5qenBYftE/OvHpqKugGLLKj1/bg=",
"lastModified": 1774596342,
"narHash": "sha256-FlUcJydnZmj0l7a08z+viSQEwtvnNFggJqlECMHfUBY=",
"owner": "kisom",
"repo": "sgard",
"rev": "b9b9082008424b7610ef6d7cf2bbcb47d1ea697d",
"rev": "de5759ac77a2aadc43d48e52e3f53551b3353659",
"type": "github"
},
"original": {

View File

@@ -32,15 +32,15 @@
cert.url = "github:kisom/cert";
cert.inputs.nixpkgs.follows = "nixpkgs";
mcias.url = "git+https://git@git.wntrmute.dev/kyle/mcias.git";
mcias.url = "git+https://git@git.wntrmute.dev/mc/mcias.git";
mcr.url = "git+https://git@git.wntrmute.dev/kyle/mcr";
mcr.url = "git+https://git@git.wntrmute.dev/mc/mcr";
mcr.inputs.nixpkgs.follows = "nixpkgs";
mc-proxy.url = "git+https://git@git.wntrmute.dev/kyle/mc-proxy";
mc-proxy.url = "git+https://git@git.wntrmute.dev/mc/mc-proxy";
mc-proxy.inputs.nixpkgs.follows = "nixpkgs";
mcdeploy.url = "git+https://git@git.wntrmute.dev/kyle/mcdeploy";
mcdeploy.url = "git+https://git@git.wntrmute.dev/mc/mcdeploy";
mcdeploy.inputs.nixpkgs.follows = "nixpkgs";
mcp.url = "git+https://git@git.wntrmute.dev/mc/mcp";

35
script/gen-update-targets.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
declare -A groups
while IFS= read -r line; do
# skip comments
[[ $line =~ ^[[:space:]]*# ]] && continue
if [[ $line =~ ^[[:space:]]*([a-zA-Z0-9_-]+)\.url[[:space:]]*=[[:space:]]*\"(.+)\"\; ]]; then
name="${BASH_REMATCH[1]}"
url="${BASH_REMATCH[2]}"
if [[ $url =~ wntrmute\.dev/kyle/ ]] || [[ $url =~ github:kisom/ ]]; then
groups[kyle]+="${groups[kyle]:+ }$name"
elif [[ $url =~ wntrmute\.dev/mc/ ]]; then
groups[mc]+="${groups[mc]:+ }$name"
fi
fi
done < flake.nix
phony=""
targets=""
for group in $(printf '%s\n' "${!groups[@]}" | sort); do
inputs="${groups[$group]}"
if [[ -n "$inputs" ]]; then
phony+=" update-$group"
targets+="update-${group}:"$'\n\t'"nix flake update ${inputs}"$'\n\n'
fi
done
printf '.PHONY:%s\n\n%s' "$phony" "$targets"