diff options
author | tv <tv@krebsco.de> | 2015-11-09 19:07:26 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-11-09 19:07:26 +0100 |
commit | 193bb70e2ea95a56839fdd79985ed27f4962426d (patch) | |
tree | 28dab916ff9a8ed7b701a965812ccbf8747869f4 /krebs/4lib/git.nix | |
parent | 1f39b86dad2f8ddeb8008f6dda02a6dea1c369a6 (diff) |
{tv => krebs} git lib & git hooks
Diffstat (limited to 'krebs/4lib/git.nix')
-rw-r--r-- | krebs/4lib/git.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/krebs/4lib/git.nix b/krebs/4lib/git.nix new file mode 100644 index 000000000..d50ba2018 --- /dev/null +++ b/krebs/4lib/git.nix @@ -0,0 +1,42 @@ +{ lib, ... }: + +let + inherit (lib) addNames escapeShellArg makeSearchPath optionalString; + + commands = addNames { + git-receive-pack = {}; + git-upload-pack = {}; + }; + + receive-modes = addNames { + fast-forward = {}; + non-fast-forward = {}; + create = {}; + delete = {}; + merge = {}; # TODO implement in git.nix + }; + + permissions = { + fetch = { + allow-commands = [ + commands.git-upload-pack + ]; + }; + + push = ref: extra-modes: { + allow-commands = [ + commands.git-receive-pack + commands.git-upload-pack + ]; + allow-receive-ref = ref; + allow-receive-modes = [ receive-modes.fast-forward ] ++ extra-modes; + }; + }; + + refs = { + master = "refs/heads/master"; + all-heads = "refs/heads/*"; + }; + +in +commands // receive-modes // permissions // refs |