aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorPatrick Jackson <patrick@jackson.dev>2024-05-07 22:51:53 +0000
committerGerrit Code Review <gerrit@lix-systems>2024-05-07 22:51:53 +0000
commitd184981af019f786df8ddb1b39527df30c62b262 (patch)
treedeb36cb5510521ccec56e77a14e4d6a4b1f37877 /flake.nix
parent8715a0ac4e5621fe48ddf6d3712c35cc08e347b2 (diff)
parent9af869436787748ce44ba9ecdf1e6f20aa5b2b83 (diff)
Merge "feat: setup gerrit commit-msg hook with nix develop" into main
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 79ac9caea..fff137239 100644
--- a/flake.nix
+++ b/flake.nix
@@ -431,6 +431,16 @@
if ! [[ -f .nocontribmsg ]]; then
cat ${contribNotice}
fi
+
+ # Install the Gerrit commit-msg hook.
+ # (git common dir is the main .git, including for worktrees)
+ if gitcommondir=$(git rev-parse --git-common-dir 2>/dev/null) && [[ ! -f "$gitcommondir/hooks/commit-msg" ]]; then
+ echo 'Installing Gerrit commit-msg hook (adds Change-Id to commit messages)' >&2
+ mkdir -p "$gitcommondir/hooks"
+ curl -s -Lo "$gitcommondir/hooks/commit-msg" https://gerrit.lix.systems/tools/hooks/commit-msg
+ chmod u+x "$gitcommondir/hooks/commit-msg"
+ fi
+ unset gitcommondir
'';
}
// lib.optionalAttrs (stdenv.buildPlatform.isLinux && pkgs.glibcLocales != null) {