stockholm/tv/2configs/git.nix

127 lines
3.1 KiB
Nix
Raw Normal View History

2015-07-11 16:55:22 +02:00
{ config, lib, pkgs, ... }:
2015-07-24 20:48:00 +02:00
2016-10-20 20:54:38 +02:00
with import <stockholm/lib>;
2017-01-05 21:03:23 +01:00
let {
2015-07-11 16:55:22 +02:00
2017-01-05 21:03:23 +01:00
body = {
2015-07-24 11:44:49 +02:00
krebs.git = {
2015-07-24 00:24:12 +02:00
enable = true;
cgit = {
settings = {
root-title = "repositories at ${config.krebs.build.host.name}";
root-desc = "mostly krebs";
};
};
2016-02-03 13:36:54 +01:00
repos = repos;
2015-08-24 11:22:05 +02:00
rules = rules;
2015-07-24 00:24:12 +02:00
};
2015-07-11 16:55:22 +02:00
};
2015-08-24 11:22:05 +02:00
repos =
2015-07-24 19:33:20 +02:00
public-repos //
2015-08-24 11:22:05 +02:00
optionalAttrs config.krebs.build.host.secure restricted-repos;
2015-07-24 19:33:20 +02:00
2015-07-24 00:24:12 +02:00
rules = concatMap make-rules (attrValues repos);
2015-07-11 16:55:22 +02:00
public-repos = mapAttrs make-public-repo ({
} // mapAttrs (_: recursiveUpdate { cgit.section = "1. miscellaneous"; }) {
2016-02-03 19:39:00 +01:00
cac-api = {
cgit.desc = "CloudAtCost API command line interface";
2015-08-06 00:11:26 +02:00
};
2016-11-24 22:40:55 +01:00
dic = {
cgit.desc = "dict.leo.org command line interface";
};
2015-09-25 22:56:28 +02:00
get = {};
2015-07-24 00:24:12 +02:00
load-env = {};
2016-11-04 23:40:43 +01:00
loldns = {
cgit.desc = "toy DNS server";
};
2015-07-24 00:24:12 +02:00
make-snapshot = {};
much = {};
2016-10-23 18:15:20 +02:00
netcup = {
cgit.desc = "netcup command line interface";
};
populate = {
cgit.desc = "source code installer";
};
2015-07-24 00:24:12 +02:00
regfish = {};
2015-12-20 12:47:10 +01:00
soundcloud = {
cgit.desc = "SoundCloud command line interface";
2015-12-20 12:47:10 +01:00
};
2015-07-24 00:24:12 +02:00
stockholm = {
cgit.desc = "NixOS configuration";
2015-07-24 00:24:12 +02:00
};
2016-11-24 22:40:55 +01:00
} // mapAttrs (_: recursiveUpdate { cgit.section = "2. Host configurations"; }) {
ni = {
};
} // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) {
blessings = {};
mime = {};
quipper = {};
scanner = {};
2015-07-24 00:24:12 +02:00
wai-middleware-time = {};
web-routes-wai-custom = {};
xintmap = {};
2015-11-09 18:01:30 +01:00
xmonad-stockholm = {};
2016-11-24 22:40:55 +01:00
} // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) {
cgserver = {};
crude-mail-setup = {};
dot-xmonad = {};
2016-11-24 22:40:55 +01:00
make-snapshot = {};
nixos-infest = {};
painload = {};
2016-11-24 22:40:55 +01:00
push = {};
with-tmpdir = {};
});
2015-07-11 16:55:22 +02:00
2015-07-24 19:33:20 +02:00
restricted-repos = mapAttrs make-restricted-repo (
{
brain = {
2015-07-24 20:48:00 +02:00
collaborators = with config.krebs.users; [ lass makefu ];
2015-07-24 19:33:20 +02:00
};
} //
2015-09-27 00:22:50 +02:00
# TODO don't put secrets/repos.nix into the store
import <secrets/repos.nix> { inherit config lib pkgs; }
2015-07-24 19:33:20 +02:00
);
make-public-repo = name: { cgit ? {}, ... }: {
inherit cgit name;
2015-07-24 00:24:12 +02:00
public = true;
2016-11-10 23:15:33 +01:00
hooks = optionalAttrs (config.krebs.build.host.name == "ni") {
post-receive = pkgs.git-hooks.irc-announce {
# TODO make nick = config.krebs.build.host.name the default
nick = config.krebs.build.host.name;
2015-07-24 00:24:12 +02:00
channel = "#retiolum";
2016-11-11 08:47:46 +01:00
server = "ni.r";
2016-04-17 11:48:54 +02:00
verbose = true;
2015-07-11 16:55:22 +02:00
};
};
2015-07-24 00:24:12 +02:00
};
2015-07-11 16:55:22 +02:00
make-restricted-repo = name: { collaborators ? [], ... }: {
inherit collaborators name;
2015-07-24 19:33:20 +02:00
public = false;
};
2015-07-24 00:24:12 +02:00
make-rules =
2015-07-24 20:48:00 +02:00
with git // config.krebs.users;
2015-07-24 00:24:12 +02:00
repo:
singleton {
2016-02-07 05:17:07 +01:00
user = [ tv tv-xu ];
2015-07-24 00:24:12 +02:00
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
} ++
optional repo.public {
user = attrValues config.krebs.users;
2015-07-24 00:24:12 +02:00
repo = [ repo ];
perm = fetch;
2015-07-24 19:33:20 +02:00
} ++
2016-02-03 13:36:54 +01:00
optional (repo.collaborators or [] != []) {
2015-07-24 19:33:20 +02:00
user = repo.collaborators;
repo = [ repo ];
perm = fetch;
2015-07-24 00:24:12 +02:00
};
2015-07-11 16:55:22 +02:00
2017-01-05 21:03:23 +01:00
}