2015-07-11 14:55:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-07-24 18:48:00 +00:00
|
|
|
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2015-11-09 17:52:11 +00:00
|
|
|
|
2017-01-05 20:03:23 +00:00
|
|
|
let {
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2017-01-05 20:03:23 +00:00
|
|
|
body = {
|
2015-07-24 09:44:49 +00:00
|
|
|
krebs.git = {
|
2015-07-23 22:24:12 +00:00
|
|
|
enable = true;
|
2016-06-07 01:14:21 +00:00
|
|
|
cgit = {
|
|
|
|
settings = {
|
|
|
|
root-title = "repositories at ${config.krebs.build.host.name}";
|
|
|
|
root-desc = "mostly krebs";
|
|
|
|
};
|
|
|
|
};
|
2016-02-03 12:36:54 +00:00
|
|
|
repos = repos;
|
2015-08-24 09:22:05 +00:00
|
|
|
rules = rules;
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
};
|
|
|
|
|
2018-08-28 19:48:00 +00:00
|
|
|
cgit-clear-cache = pkgs.cgit-clear-cache.override {
|
|
|
|
inherit (config.krebs.git.cgit.settings) cache-root;
|
|
|
|
};
|
|
|
|
|
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 ({
|
2016-06-07 01:14:21 +00:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "1. miscellaneous"; }) {
|
2016-02-03 18:39:00 +00:00
|
|
|
cac-api = {
|
2016-06-07 01:14:21 +00:00
|
|
|
cgit.desc = "CloudAtCost API command line interface";
|
2015-08-05 22:11:26 +00:00
|
|
|
};
|
2016-11-24 21:40:55 +00:00
|
|
|
dic = {
|
|
|
|
cgit.desc = "dict.leo.org command line interface";
|
|
|
|
};
|
2018-07-13 12:24:57 +00:00
|
|
|
disko = {
|
|
|
|
cgit.desc = "declarative partitioning and formatting tool";
|
|
|
|
};
|
2015-09-25 20:56:28 +00:00
|
|
|
get = {};
|
2017-05-09 17:17:08 +00:00
|
|
|
hstool = {
|
|
|
|
cgit.desc = "Haskell Development Environment ^_^";
|
|
|
|
};
|
2017-04-18 17:58:49 +00:00
|
|
|
htgen = {
|
|
|
|
cgit.desc = "toy HTTP server";
|
|
|
|
};
|
2017-05-02 20:11:50 +00:00
|
|
|
kirk = {
|
|
|
|
cgit.desc = "IRC tools";
|
2017-04-11 21:15:35 +00:00
|
|
|
};
|
2018-05-03 16:41:08 +00:00
|
|
|
krops = {
|
2018-02-28 21:38:42 +00:00
|
|
|
cgit.desc = "deployment tools";
|
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
load-env = {};
|
2016-11-04 22:40:43 +00:00
|
|
|
loldns = {
|
|
|
|
cgit.desc = "toy DNS server";
|
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
make-snapshot = {};
|
|
|
|
much = {};
|
2016-10-23 16:15:20 +00:00
|
|
|
netcup = {
|
|
|
|
cgit.desc = "netcup command line interface";
|
|
|
|
};
|
2018-06-12 18:30:05 +00:00
|
|
|
nix-writers = {};
|
2016-10-23 16:15:20 +00:00
|
|
|
populate = {
|
|
|
|
cgit.desc = "source code installer";
|
|
|
|
};
|
2017-04-18 17:58:53 +00:00
|
|
|
q = {};
|
2015-07-23 22:24:12 +00:00
|
|
|
regfish = {};
|
2015-12-20 11:47:10 +00:00
|
|
|
soundcloud = {
|
2016-06-07 01:14:21 +00:00
|
|
|
cgit.desc = "SoundCloud command line interface";
|
2015-12-20 11:47:10 +00:00
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
stockholm = {
|
2016-06-07 01:14:21 +00:00
|
|
|
cgit.desc = "NixOS configuration";
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2016-11-24 21:40:55 +00:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "2. Host configurations"; }) {
|
|
|
|
ni = {
|
|
|
|
};
|
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "3. 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 = {};
|
2016-11-24 21:40:55 +00:00
|
|
|
} // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) {
|
2015-11-09 17:34:02 +00:00
|
|
|
cgserver = {};
|
|
|
|
crude-mail-setup = {};
|
|
|
|
dot-xmonad = {};
|
2017-04-18 17:58:37 +00:00
|
|
|
hirc = {};
|
2016-11-24 21:40:55 +00:00
|
|
|
make-snapshot = {};
|
2015-11-09 17:34:02 +00:00
|
|
|
nixos-infest = {};
|
|
|
|
painload = {};
|
2016-11-24 21:40:55 +00:00
|
|
|
push = {};
|
|
|
|
with-tmpdir = {};
|
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 ];
|
2018-08-28 19:48:00 +00:00
|
|
|
hooks = {
|
|
|
|
post-receive = /* sh */ ''
|
|
|
|
(${irc-announce { cgit_endpoint = null; }})
|
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
2017-06-19 21:07:51 +00:00
|
|
|
};
|
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
|
|
|
);
|
|
|
|
|
2017-06-19 21:07:51 +00:00
|
|
|
irc-announce = args: pkgs.git-hooks.irc-announce (recursiveUpdate {
|
2017-10-01 12:31:00 +00:00
|
|
|
channel = "#xxx";
|
2017-06-19 20:46:26 +00:00
|
|
|
# TODO make nick = config.krebs.build.host.name the default
|
|
|
|
nick = config.krebs.build.host.name;
|
2017-10-01 11:43:00 +00:00
|
|
|
server = "irc.r";
|
2017-06-19 20:46:26 +00:00
|
|
|
verbose = true;
|
2017-06-19 21:07:51 +00:00
|
|
|
} args);
|
2017-06-19 20:46:26 +00:00
|
|
|
|
2016-06-07 01:14:21 +00:00
|
|
|
make-public-repo = name: { cgit ? {}, ... }: {
|
|
|
|
inherit cgit name;
|
2015-07-23 22:24:12 +00:00
|
|
|
public = true;
|
2018-08-28 19:48:00 +00:00
|
|
|
hooks = {
|
|
|
|
post-receive = /* sh */ ''
|
|
|
|
(${optionalString (config.krebs.build.host.name == "ni")
|
|
|
|
(irc-announce {})})
|
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
2015-07-11 14:55:22 +00:00
|
|
|
};
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2017-06-19 20:46:26 +00:00
|
|
|
make-restricted-repo = name: { collaborators ? [], hooks ? {}, ... }: {
|
2018-08-28 19:48:00 +00:00
|
|
|
inherit collaborators name;
|
2015-07-24 17:33:20 +00:00
|
|
|
public = false;
|
2018-08-28 19:48:00 +00:00
|
|
|
hooks = hooks // {
|
|
|
|
post-receive = /* sh */ ''
|
|
|
|
(${hooks.post-receive or ""})
|
|
|
|
${cgit-clear-cache}/bin/cgit-clear-cache
|
|
|
|
'';
|
|
|
|
};
|
2015-07-24 17:33:20 +00:00
|
|
|
};
|
|
|
|
|
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 {
|
2016-02-07 04:17:07 +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 ];
|
|
|
|
} ++
|
2016-02-03 12:36:54 +00:00
|
|
|
optional (repo.collaborators or [] != []) {
|
2015-07-24 17:33:20 +00:00
|
|
|
user = repo.collaborators;
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
2015-07-23 22:24:12 +00:00
|
|
|
};
|
2015-07-11 14:55:22 +00:00
|
|
|
|
2017-01-05 20:03:23 +00:00
|
|
|
}
|