2015-07-11 14:55:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-24 18:48:00 +00:00
|
|
|
|
2015-11-09 17:52:11 +00:00
|
|
|
with lib;
|
|
|
|
|
2015-07-11 14:55:22 +00:00
|
|
|
let
|
|
|
|
|
2015-07-23 22:24:12 +00:00
|
|
|
out = {
|
2015-07-24 09:44:49 +00:00
|
|
|
krebs.git = {
|
2015-07-23 22:24:12 +00:00
|
|
|
enable = true;
|
2015-07-24 22:04:04 +00:00
|
|
|
root-title = "public repositories at ${config.krebs.build.host.name}";
|
2015-07-23 22:24:12 +00:00
|
|
|
root-desc = "keep calm and engage";
|
2015-08-24 09:22:05 +00:00
|
|
|
repos = mapAttrs (_: s: removeAttrs s ["collaborators"]) repos;
|
|
|
|
rules = rules;
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
};
|
|
|
|
|
2015-08-24 09:22:05 +00:00
|
|
|
repos =
|
2015-07-24 17:33:20 +00:00
|
|
|
public-repos //
|
2015-08-24 09:22:05 +00:00
|
|
|
optionalAttrs config.krebs.build.host.secure restricted-repos;
|
2015-07-24 17:33:20 +00:00
|
|
|
|
2015-07-23 22:24:12 +00:00
|
|
|
rules = concatMap make-rules (attrValues repos);
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2015-10-17 06:00:35 +00:00
|
|
|
public-repos = mapAttrs make-public-repo ({
|
2015-11-09 17:34:02 +00:00
|
|
|
} // mapAttrValues (setAttr "section" "1. Miscellaneous") {
|
2015-08-05 22:11:26 +00:00
|
|
|
cac = {
|
|
|
|
desc = "CloudAtCost command line interface";
|
|
|
|
};
|
2015-09-25 20:56:28 +00:00
|
|
|
get = {};
|
2015-07-23 22:24:12 +00:00
|
|
|
hack = {};
|
|
|
|
load-env = {};
|
|
|
|
make-snapshot = {};
|
|
|
|
much = {};
|
|
|
|
nixpkgs = {};
|
2015-10-15 00:00:32 +00:00
|
|
|
push = {};
|
2015-07-23 22:24:12 +00:00
|
|
|
regfish = {};
|
2015-12-20 11:47:10 +00:00
|
|
|
soundcloud = {
|
|
|
|
desc = "SoundCloud command line interface";
|
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
stockholm = {
|
|
|
|
desc = "take all the computers hostage, they'll love you!";
|
|
|
|
};
|
2015-11-09 17:34:02 +00:00
|
|
|
} // mapAttrValues (setAttr "section" "2. Haskell libraries") {
|
2015-10-17 06:00:35 +00:00
|
|
|
blessings = {};
|
|
|
|
mime = {};
|
|
|
|
quipper = {};
|
|
|
|
scanner = {};
|
2015-07-23 22:24:12 +00:00
|
|
|
wai-middleware-time = {};
|
|
|
|
web-routes-wai-custom = {};
|
|
|
|
xintmap = {};
|
2015-11-09 17:01:30 +00:00
|
|
|
xmonad-stockholm = {};
|
2015-11-09 17:34:02 +00:00
|
|
|
} // mapAttrValues (setAttr "section" "3. Museum") {
|
|
|
|
cgserver = {};
|
|
|
|
crude-mail-setup = {};
|
|
|
|
dot-xmonad = {};
|
|
|
|
nixos-infest = {};
|
|
|
|
painload = {};
|
2015-10-17 06:00:35 +00:00
|
|
|
});
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2015-07-24 17:33:20 +00:00
|
|
|
restricted-repos = mapAttrs make-restricted-repo (
|
|
|
|
{
|
|
|
|
brain = {
|
2015-07-24 18:48:00 +00:00
|
|
|
collaborators = with config.krebs.users; [ lass makefu ];
|
2015-07-24 17:33:20 +00:00
|
|
|
};
|
|
|
|
} //
|
2015-09-26 22:22:50 +00:00
|
|
|
# TODO don't put secrets/repos.nix into the store
|
|
|
|
import <secrets/repos.nix> { inherit config lib pkgs; }
|
2015-07-24 17:33:20 +00:00
|
|
|
);
|
|
|
|
|
2015-10-17 06:00:35 +00:00
|
|
|
make-public-repo = name: { desc ? null, section ? null, ... }: {
|
|
|
|
inherit name desc section;
|
2015-07-23 22:24:12 +00:00
|
|
|
public = true;
|
2015-10-01 18:33:18 +00:00
|
|
|
hooks = {
|
2015-11-09 17:51:26 +00:00
|
|
|
post-receive = pkgs.git-hooks.irc-announce {
|
2015-07-24 22:04:04 +00:00
|
|
|
# TODO make nick = config.krebs.build.host.name the default
|
|
|
|
nick = config.krebs.build.host.name;
|
2015-07-23 22:24:12 +00:00
|
|
|
channel = "#retiolum";
|
|
|
|
server = "cd.retiolum";
|
2015-10-01 18:33:18 +00:00
|
|
|
verbose = config.krebs.build.host.name == "cd";
|
2015-07-11 14:55:22 +00:00
|
|
|
};
|
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2015-08-24 09:22:05 +00:00
|
|
|
make-restricted-repo = name: { collaborators ? [], desc ? null, ... }: {
|
|
|
|
inherit name collaborators desc;
|
2015-07-24 17:33:20 +00:00
|
|
|
public = false;
|
|
|
|
};
|
|
|
|
|
2015-07-23 22:24:12 +00:00
|
|
|
make-rules =
|
2015-07-24 18:48:00 +00:00
|
|
|
with git // config.krebs.users;
|
2015-07-23 22:24:12 +00:00
|
|
|
repo:
|
|
|
|
singleton {
|
2015-11-09 17:01:52 +00:00
|
|
|
user = [ tv tv_xu ];
|
2015-07-23 22:24:12 +00:00
|
|
|
repo = [ repo ];
|
|
|
|
perm = push "refs/*" [ non-fast-forward create delete merge ];
|
|
|
|
} ++
|
|
|
|
optional repo.public {
|
|
|
|
user = [ lass makefu uriel ];
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
2015-07-24 17:33:20 +00:00
|
|
|
} ++
|
|
|
|
optional (length (repo.collaborators or []) > 0) {
|
|
|
|
user = repo.collaborators;
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2015-07-23 22:24:12 +00:00
|
|
|
in out
|