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-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-09-02 08:02:05 +00:00
|
|
|
brain = {
|
|
|
|
desc = "braiiiins";
|
2015-07-24 20:39:11 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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;
|
2015-09-02 08:02:05 +00:00
|
|
|
public = false;
|
2015-07-24 20:39:11 +00:00
|
|
|
hooks = {
|
2015-11-17 12:55:30 +00:00
|
|
|
post-receive = pkgs.git-hooks.irc-announce {
|
2015-07-24 20:39:11 +00:00
|
|
|
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-10-10 18:21:52 +00:00
|
|
|
singleton {
|
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
|
2015-09-02 08:02:05 +00:00
|
|
|
krebsminister = with config.krebs.users; [ lass tv ];
|
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" ;
|
2015-09-02 08:02:05 +00:00
|
|
|
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_omo.ssh.pub;
|
2015-07-29 12:22:24 +00:00
|
|
|
};
|
2015-08-09 13:13:01 +00:00
|
|
|
krebs.users.makefu-tsp = {
|
|
|
|
name = "makefu-tsp" ;
|
2015-09-02 08:02:05 +00:00
|
|
|
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_tsp.ssh.pub;
|
2015-08-09 13:13:01 +00:00
|
|
|
};
|
2015-07-29 12:22:24 +00:00
|
|
|
}];
|
2015-07-28 18:21:34 +00:00
|
|
|
krebs.git = {
|
|
|
|
enable = true;
|
2015-09-02 08:02:05 +00:00
|
|
|
cgit = false;
|
2015-07-28 18:21:34 +00:00
|
|
|
inherit repos rules;
|
|
|
|
};
|
|
|
|
}
|