nixos-config/2configs/git/cgit-retiolum.nix

102 lines
2.4 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
# TODO: remove tv lib :)
2016-10-20 20:54:38 +02:00
with import <stockholm/lib>;
let
2015-11-17 13:55:30 +01:00
repos = priv-repos // krebs-repos // connector-repos ;
rules = concatMap krebs-rules (attrValues krebs-repos)
++ concatMap priv-rules (attrValues priv-repos)
++ concatMap connector-rules (attrValues connector-repos);
krebs-repos = mapAttrs make-krebs-repo {
stockholm = {
cgit.desc = "Make all the systems into 1systems!";
};
2015-10-19 19:46:26 +02:00
tinc_graphs = {
cgit.desc = "Tinc Advanced Graph Generation";
2015-10-19 19:46:26 +02:00
};
2016-06-02 11:13:31 +02:00
stockholm-init = {
cgit.desc = "Build new Stockholm hosts";
2016-06-02 11:13:31 +02:00
};
2016-02-22 14:27:25 +01:00
cac-api = { };
2017-05-12 11:37:00 +02:00
ampel = { };
2016-01-19 20:04:29 +01:00
init-stockholm = {
cgit.desc = "Init stuff for stockholm";
2016-01-19 20:04:29 +01:00
};
};
priv-repos = mapAttrs make-priv-repo {
autosync = { };
2017-02-04 14:35:29 +01:00
pass = { };
};
2015-11-17 13:55:30 +01:00
connector-repos = mapAttrs make-priv-repo {
connector = { };
2015-12-14 14:32:20 +01:00
minikrebs = { };
2015-12-03 20:36:09 +01:00
mattermost = {
cgit.desc = "Mattermost Docker files";
2015-12-03 20:36:09 +01:00
};
2015-11-17 13:55:30 +01:00
};
# TODO move users to separate module
make-priv-repo = name: { ... }: {
inherit name;
public = false;
};
make-krebs-repo = with git; name: { cgit ? {}, ... }: {
inherit cgit name;
public = true;
hooks = {
post-receive = pkgs.git-hooks.irc-announce {
nick = config.networking.hostName;
2015-12-14 14:36:36 +01:00
verbose = config.krebs.build.host.name == "gum";
channel = "#retiolum";
2015-07-29 14:22:24 +02:00
# TODO remove the hardcoded hostname
2016-11-11 08:47:46 +01:00
server = "ni.r";
};
};
};
# TODO: get the list of all krebsministers
2016-02-17 03:13:42 +01:00
krebsminister = with config.krebs.users; [ lass tv ];
2017-02-04 14:35:29 +01:00
all-makefu = with config.krebs.users; [ makefu makefu-omo makefu-tsp makefu-vbob makefu-tempx ];
all-exco = with config.krebs.users; [ exco ];
2015-07-29 14:22:24 +02:00
priv-rules = repo: set-owners repo all-makefu;
connector-rules = repo: set-owners repo all-makefu ++ set-owners repo all-exco;
2015-11-17 13:55:30 +01:00
2015-07-29 14:22:24 +02:00
krebs-rules = repo:
set-owners repo all-makefu ++ set-ro-access repo krebsminister;
2015-11-17 13:55:30 +01:00
set-ro-access = with git; repo: user:
optional repo.public {
inherit user;
repo = [ repo ];
perm = fetch;
};
set-owners = with git;repo: user:
singleton {
inherit user;
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
};
in {
krebs.git = {
enable = true;
cgit = {
settings = {
root-title = "public repositories";
root-desc = "keep on krebsing";
};
};
inherit repos rules;
};
}