summaryrefslogtreecommitdiffstats
path: root/modules/mors/git.nix
blob: 1dd61d16439911e79ddcbb470978fb069c776d7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ config, lib, pkgs, ... }:

{
  imports = [
    ../tv/git
  ];

  services.git =
    let
      inherit (builtins) readFile;
      # TODO lib should already include our stuff
      inherit (import ../../lib { inherit lib pkgs; }) addNames git;

      krebs-private = name: desc:
          {
            inherit desc;
            hooks = {
              post-receive = git.irc-announce {
                nick = config.networking.hostName; # TODO make this the default
                channel = "#retiolum";
                server = "ire.retiolum";
              };
            };
          }
    in rec {
      enable = true;

      users = addNames {
        tv = { pubkey = readFile <pubkeys/tv.ssh.pub>; };
        lass = { pubkey = readFile <pubkeys/lass.ssh.pub>; };
        uriel = { pubkey = readFile <pubkeys/lass.ssh.pub>; };
        makefu = { pubkey = "xxx"; };
      };

      repos = addNames {
        shitment = {
          desc = "shitment repository";
          hooks = {
            post-receive = git.irc-announce {
              nick = config.networking.hostName; # TODO make this the default
              channel = "#retiolum";
              server = "ire.retiolum";
            };
          };
          public = true;
        };
        testing = {
          desc = "testing repository";
          hooks = {
            post-receive = git.irc-announce {
              nick = config.networking.hostName; # TODO make this the default
              channel = "#repository";
              server = "ire.retiolum";
            };
          };
          public = true;
        };
      };

      rules = with git; with users; with repos; [
        { user = lass;
          repo = [ testing shitment ];
          perm = push master [ non-fast-forward create delete merge ];
        }
        { user = [ tv uriel makefu ];
          repo = [ testing shitment ];
          perm = fetch;
        }
      ];
    };
}