stockholm/tv/2configs/git.nix

110 lines
2.6 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-02-14 16:43:44 +01:00
with config.krebs.lib;
2015-07-11 16:55:22 +02:00
let
2015-07-24 00:24:12 +02:00
out = {
2015-07-24 11:44:49 +02:00
krebs.git = {
2015-07-24 00:24:12 +02:00
enable = true;
2016-02-08 04:12:56 +01:00
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 ({
2016-02-08 04:12:56 +01:00
} // mapAttrValues (setAttr "section" "1. miscellaneous") {
2016-02-03 19:39:00 +01:00
cac-api = {
desc = "CloudAtCost API command line interface";
2015-08-06 00:11:26 +02:00
};
2015-09-25 22:56:28 +02:00
get = {};
2015-07-24 00:24:12 +02:00
hack = {};
load-env = {};
make-snapshot = {};
much = {};
2016-03-15 13:55:01 +01:00
newsbot-js = {};
2015-07-24 00:24:12 +02:00
nixpkgs = {};
2015-10-15 02:00:32 +02:00
push = {};
2015-07-24 00:24:12 +02:00
regfish = {};
2015-12-20 12:47:10 +01:00
soundcloud = {
desc = "SoundCloud command line interface";
};
2015-07-24 00:24:12 +02:00
stockholm = {
2016-02-08 04:12:56 +01:00
desc = "NixOS configuration";
2015-07-24 00:24:12 +02:00
};
2016-02-02 15:34:22 +01:00
with-tmpdir = {};
} // mapAttrValues (setAttr "section" "2. 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-02-08 04:12:56 +01:00
} // mapAttrValues (setAttr "section" "3. museum") {
cgserver = {};
crude-mail-setup = {};
dot-xmonad = {};
nixos-infest = {};
painload = {};
});
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: { desc ? null, section ? null, ... }: {
inherit name desc section;
2015-07-24 00:24:12 +02:00
public = true;
hooks = {
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";
server = "cd.retiolum";
verbose = config.krebs.build.host.name == "cd";
2015-07-11 16:55:22 +02:00
};
};
2015-07-24 00:24:12 +02:00
};
2015-07-11 16:55:22 +02:00
2015-08-24 11:22:05 +02:00
make-restricted-repo = name: { collaborators ? [], desc ? null, ... }: {
inherit name collaborators desc;
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 = [ lass makefu ];
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
2015-07-24 00:24:12 +02:00
in out