summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@nullring.xyz>2026-03-04 01:56:58 -0800
committerPreston Pan <ret2pop@nullring.xyz>2026-03-04 01:56:58 -0800
commitae6812767c6fcfe202d5904996b0a49e58461593 (patch)
tree370add943eb72d9e5fe1535641a096c726bbd1bb
parentccb80591f8c83c2375fe06ff8722f7347d235c1e (diff)
add merge hook
l---------.pre-commit-config.yaml2
-rw-r--r--flake.nix30
2 files changed, 31 insertions, 1 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index cfd0eb2..08881cf 120000
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1 +1 @@
-/nix/store/961bl5px4kwhk3a4f8hsjdbdrqdnzli9-pre-commit-config.json \ No newline at end of file
+/nix/store/vr84ka433s76vh9km0xm2c3apaqmdn4m-pre-commit-config.json \ No newline at end of file
diff --git a/flake.nix b/flake.nix
index 48e79bf..c7b5186 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,10 +18,39 @@
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
+
+
pre-commit-check = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
deadnix.enable = true;
+ website-build-check = {
+ enable = true;
+ name = "website-build";
+ description = "Ensure website can build, and tests links";
+ stages = [ "post-merge" ];
+ entry = "${pkgs.writeShellScript "website-check" ''
+BRANCH=$(git branch --show-current)
+if [ "$BRANCH" != "main" ]; then
+ exit 0
+fi
+RESULT_PATH=$(nix build .#website --no-link --print-out-paths)
+if [ -d "$RESULT_PATH" ]; then
+ echo "Running lychee link check..."
+ mkdir -p results
+ # Run lychee on the output directory
+ # --output results/lychee_report.md (or .txt, .json)
+ ${pkgs.lychee}/bin/lychee "$RESULT_PATH" \
+ --verbose || echo "Lychee found broken links."
+else
+ echo "Website build failed, skipping lychee."
+ exit 1
+fi
+''}";
+ pass_filenames = false;
+ always_run = true;
+ };
+
prevent-direct-main-commits = {
enable = true;
name = "Prevent direct commits to main";
@@ -64,6 +93,7 @@ fi
dvisvgm;
})
];
+
buildPhase = ''
export HOME=$TMPDIR/fake-home
mkdir -p $HOME/.emacs.d