stockholm/makefu/2configs/cgit-retiolum.nix

71 lines
1.7 KiB
Nix
Raw Normal View History

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-28 23:07:41 +00:00
with import ../../tv/4lib/{ inherit lib pkgs; };
2015-07-24 20:39:11 +00:00
let
out = {
2015-07-28 23:07:41 +00:00
imports = [ ];
2015-07-24 20:39:11 +00:00
krebs.git = {
enable = true;
root-title = "public repositories ";
2015-07-28 17:56:53 +00:00
root-desc = "keep on krebsing";
inherit repos rules;
2015-07-24 20:39:11 +00:00
};
};
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";
server = "cd.retiolum";
};
};
};
2015-07-28 17:56:53 +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 ];
priv-rules = with config.krebs.users; repo:
set-owners repo [ makefu ];
krebs-rules = with config.krebs.users; repo:
set-owners repo [ makefu ] ++ set-ro-access repo krebsminister ;
2015-07-24 20:39:11 +00:00
in out