2015-07-24 20:39:11 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-28 17:56:53 +00:00
|
|
|
# TODO: remove tv lib :)
|
2015-07-29 09:56:31 +00:00
|
|
|
with import ../../tv/4lib { inherit lib pkgs; };
|
2015-07-24 20:39:11 +00:00
|
|
|
let
|
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
repos = priv-repos // krebs-repos ;
|
|
|
|
rules = concatMap krebs-rules (attrValues krebs-repos) ++ concatMap priv-rules (attrValues priv-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 = {
|
|
|
|
desc = "take all the computers hostage, they'll love you!";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-28 17:56:53 +00:00
|
|
|
priv-repos = mapAttrs make-priv-repo {
|
|
|
|
autosync = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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 = {
|
|
|
|
post-receive = git.irc-announce {
|
|
|
|
nick = config.networking.hostName;
|
|
|
|
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-29 12:22:24 +00:00
|
|
|
set-owners = with git;repo: user:
|
2015-07-24 20:39:11 +00:00
|
|
|
singleton {
|
2015-07-28 17:56:53 +00:00
|
|
|
inherit user;
|
2015-07-24 20:39:11 +00:00
|
|
|
repo = [ repo ];
|
|
|
|
perm = push "refs/*" [ non-fast-forward create delete merge ];
|
2015-07-28 17:56:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
set-ro-access = with git; repo: user:
|
2015-07-24 20:39:11 +00:00
|
|
|
optional repo.public {
|
2015-07-28 17:56:53 +00:00
|
|
|
inherit user;
|
2015-07-24 20:39:11 +00:00
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
|
|
|
};
|
|
|
|
|
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-07-29 12:22:24 +00:00
|
|
|
|
|
|
|
priv-rules = repo: set-owners repo all-makefu;
|
|
|
|
|
|
|
|
krebs-rules = repo:
|
|
|
|
set-owners repo all-makefu ++ set-ro-access repo krebsminister;
|
2015-07-28 17:56:53 +00:00
|
|
|
|
2015-07-28 18:21:34 +00:00
|
|
|
in {
|
2015-07-29 12:22:24 +00:00
|
|
|
imports = [{
|
|
|
|
krebs.users.makefu-omo = {
|
|
|
|
name = "makefu-omo" ;
|
|
|
|
pubkey= with builtins; readFile ../../Zpubkeys/makefu_omo.ssh.pub;
|
|
|
|
};
|
2015-08-09 13:13:01 +00:00
|
|
|
krebs.users.makefu-tsp = {
|
|
|
|
name = "makefu-tsp" ;
|
|
|
|
pubkey= with builtins; readFile ../../Zpubkeys/makefu_tsp.ssh.pub;
|
|
|
|
};
|
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;
|
|
|
|
};
|
|
|
|
}
|