2015-07-24 20:39:11 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-28 17:56:53 +00:00
|
|
|
# TODO: remove tv lib :)
|
2015-11-17 12:55:30 +00:00
|
|
|
with lib;
|
2015-07-24 20:39:11 +00:00
|
|
|
let
|
|
|
|
|
2015-11-17 12:55:30 +00: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);
|
2015-07-24 20:39:11 +00:00
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
krebs-repos = mapAttrs make-krebs-repo {
|
2015-07-24 20:39:11 +00:00
|
|
|
stockholm = {
|
2015-08-23 12:49:54 +00:00
|
|
|
desc = "Make all the systems into 1systems!";
|
2015-07-24 20:39:11 +00:00
|
|
|
};
|
2015-10-19 17:46:26 +00:00
|
|
|
tinc_graphs = {
|
|
|
|
desc = "Tinc Advanced Graph Generation";
|
|
|
|
};
|
2015-07-24 20:39:11 +00:00
|
|
|
};
|
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
priv-repos = mapAttrs make-priv-repo {
|
|
|
|
autosync = { };
|
|
|
|
};
|
|
|
|
|
2015-11-17 12:55:30 +00:00
|
|
|
connector-repos = mapAttrs make-priv-repo {
|
2015-11-17 21:16:55 +00:00
|
|
|
connector = { };
|
2015-11-17 12:55:30 +00:00
|
|
|
};
|
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
|
2015-07-24 20:39:11 +00:00
|
|
|
# TODO move users to separate module
|
2015-07-28 17:56:53 +00:00
|
|
|
make-priv-repo = name: { desc ? null, ... }: {
|
|
|
|
inherit name desc;
|
|
|
|
public = false;
|
|
|
|
};
|
2015-07-24 20:39:11 +00:00
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
make-krebs-repo = with git; name: { desc ? null, ... }: {
|
2015-07-24 20:39:11 +00:00
|
|
|
inherit name desc;
|
|
|
|
public = true;
|
|
|
|
hooks = {
|
2015-11-17 21:16:55 +00:00
|
|
|
post-receive = pkgs.git-hooks.irc-announce {
|
2015-07-24 20:39:11 +00:00
|
|
|
nick = config.networking.hostName;
|
2015-10-05 15:57:00 +00:00
|
|
|
verbose = config.krebs.build.host.name == "pnp";
|
2015-07-24 20:39:11 +00:00
|
|
|
channel = "#retiolum";
|
2015-07-29 12:22:24 +00:00
|
|
|
# TODO remove the hardcoded hostname
|
2015-07-24 20:39:11 +00:00
|
|
|
server = "cd.retiolum";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
|
2015-07-24 20:39:11 +00:00
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
# TODO: get the list of all krebsministers
|
|
|
|
krebsminister = with config.krebs.users; [ lass tv uriel ];
|
2015-08-09 13:13:01 +00:00
|
|
|
all-makefu = with config.krebs.users; [ makefu makefu-omo makefu-tsp ];
|
2015-11-17 21:16:55 +00:00
|
|
|
all-exco = with config.krebs.users; [ exco ];
|
2015-07-29 12:22:24 +00:00
|
|
|
|
|
|
|
priv-rules = repo: set-owners repo all-makefu;
|
|
|
|
|
2015-11-17 21:16:55 +00:00
|
|
|
connector-rules = repo: set-owners repo all-makefu ++ set-owners repo all-exco;
|
2015-11-17 12:55:30 +00:00
|
|
|
|
2015-07-29 12:22:24 +00:00
|
|
|
krebs-rules = repo:
|
|
|
|
set-owners repo all-makefu ++ set-ro-access repo krebsminister;
|
2015-07-28 17:56:53 +00:00
|
|
|
|
2015-11-17 12:55:30 +00: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 ];
|
|
|
|
};
|
|
|
|
|
2015-07-28 18:21:34 +00:00
|
|
|
in {
|
2015-07-29 12:22:24 +00:00
|
|
|
imports = [{
|
2015-11-17 21:16:55 +00:00
|
|
|
krebs.users = {
|
|
|
|
makefu-omo = {
|
2015-07-29 12:22:24 +00:00
|
|
|
name = "makefu-omo" ;
|
2015-09-02 08:02:05 +00:00
|
|
|
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_omo.ssh.pub;
|
2015-11-17 21:16:55 +00:00
|
|
|
};
|
|
|
|
makefu-tsp = {
|
2015-08-09 13:13:01 +00:00
|
|
|
name = "makefu-tsp" ;
|
2015-09-02 08:02:05 +00:00
|
|
|
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_tsp.ssh.pub;
|
2015-11-17 21:16:55 +00:00
|
|
|
};
|
|
|
|
exco = {
|
|
|
|
name = "exco";
|
2015-11-17 12:55:30 +00:00
|
|
|
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/exco.ssh.pub;
|
2015-11-17 21:16:55 +00:00
|
|
|
};
|
2015-11-17 12:55:30 +00:00
|
|
|
};
|
2015-07-29 12:22:24 +00:00
|
|
|
}];
|
2015-07-28 18:21:34 +00:00
|
|
|
krebs.git = {
|
|
|
|
enable = true;
|
2015-07-29 12:22:24 +00:00
|
|
|
root-title = "public repositories";
|
2015-07-28 18:21:34 +00:00
|
|
|
root-desc = "keep on krebsing";
|
|
|
|
inherit repos rules;
|
|
|
|
};
|
|
|
|
}
|