Git hook not working

I have the following git hook:

It worked fine on Ubuntu but for some reason it doesn’t work on NixOS.
I tried to execute the individual commands and they are working just fine.
It doesn’t show me any error messages so I’m currently a bit lost how I should continue debugging this.

debug your hook, what does this give you (or what ever hook your using)

bash  -x .git/hooks/pre-commit

What error is printed.

It just hangs at the cat:

~/playground/foo 99-test $ bash -x ~/.config/git/hooks/prepare-commit-msg
++ git rev-parse --abbrev-ref HEAD
+ branchName=99-test
++ echo 99-test
++ sed -nE 's,([A-Z]?-?[0-9]+)-.+,\1,p'
+ issueId=99
+ [[ ! -z 99 ]]
++ cat

Okay when I provide a file name it seems to work:

~/playground/foo]$ bash -x ~/.config/git/hooks/prepare-commit-msg foo.txt
++ git rev-parse --abbrev-ref HEAD
+ branchName=99-test
++ echo 99-test
++ sed -nE 's,([A-Z]?-?[0-9]+)-.+,\1,p'
+ issueId=99
+ [[ ! -z 99 ]]
++ cat foo.txt
+ echo -e '#99 a line'

git commit doesn’t get the line however:

Dumb question… Did you remember to make it executable?

Yes, its mode is 755.

Found the problem by the way.
The reason why it worked on Ubuntu is because they have most likely a global git config where the core.hooksPath is configured.
On NixOS this isn’t the case so you have to set it yourself:
https://git.2li.ch/Nebucatnetzer/nixos/src/branch/master/home-manager/software/git/default.nix#L16