aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorPatrick Jackson <patrick@jackson.dev>2024-05-07 11:33:03 -0700
committerJade Lovelace <lix@jade.fyi>2024-05-07 14:20:09 -0700
commit9af869436787748ce44ba9ecdf1e6f20aa5b2b83 (patch)
tree596298528b3ad4c0ff0ba8cc24b0933e45b5f4ef /flake.nix
parent964ac8b0e88fb5789b87e33273e42363958d0afb (diff)
feat: setup gerrit commit-msg hook with nix develop
Closes #273 Change-Id: Id883d2cda06adbcae53b8c360ad015330f0af81b
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 1c090cadf..ddf3967dc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -503,6 +503,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) {