summaryrefslogtreecommitdiffstats
path: root/old/modules/tv/git/options.nix
blob: c251d7d4c9dac34e788496b9eece694af1765c42 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{ lib, ... }: 

let
  inherit (lib) literalExample mkOption types;
in

{
  enable = mkOption {
    type = types.bool;
    default = false;
    description = "Enable Git repository hosting.";
  };
  cgit = mkOption {
    type = types.bool;
    default = true;
    description = "Enable cgit."; # TODO better desc; talk about nginx
  };
  dataDir = mkOption {
    type = types.str;
    default = "/var/lib/git";
    description = "Directory used to store repositories.";
  };
  etcDir = mkOption {
    type = types.str;
    default = "/etc/git";
  };
  rules = mkOption {
    type = types.unspecified;
  };
  repos = mkOption {
    type = types.attrsOf (types.submodule ({
      options = {
        desc = mkOption {
          type = types.nullOr types.str;
          default = null;
          description = ''
            Repository description.
          '';
        };
        section = mkOption {
          type = types.nullOr types.str;
          default = null;
          description = ''
            Repository section.
          '';
        };
        name = mkOption {
          type = types.str;
          description = ''
            Repository name.
          '';
        };
        hooks = mkOption {
          type = types.attrsOf types.str;
          description = ''
            Repository-specific hooks.
          '';
        };
        public = mkOption {
          type = types.bool;
          default = false;
          description = ''
            Allow everybody to read the repository via HTTP if cgit enabled.
          '';
          # TODO allow every configured user to fetch the repository via SSH.
        };
      };
    }));

    default = {};

    example = literalExample ''
      {
        testing = {
          name = "testing";
          hooks.post-update = '''
            #! /bin/sh
            set -euf
            echo post-update hook: $* >&2
          ''';
        };
        testing2 = { name = "testing2"; };
      }
    '';

    description = ''
      Repositories.
    '';
  };
  users = mkOption {
    type = types.unspecified;
  };
}