From 959417b490847ca28f10ba8ae8486b496ecb7dd9 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 19 Jun 2015 00:36:27 +0200 Subject: [PATCH] host cd: add all public repos --- modules/cd/git.nix | 104 ++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/modules/cd/git.nix b/modules/cd/git.nix index 88d4968a6..12dacffc2 100644 --- a/modules/cd/git.nix +++ b/modules/cd/git.nix @@ -1,9 +1,66 @@ { config, lib, pkgs, ... }: let - inherit (builtins) readFile; + inherit (builtins) map readFile; + inherit (lib) concatMap listToAttrs; # TODO lib should already include our stuff inherit (import ../../lib { inherit lib pkgs; }) addNames git; + + cd-repos = [ + (public "cgserver") + (public "crude-mail-setup") + (public "dot-xmonad") + (public "hack") + (public "load-env") + (public "make-snapshot") + (public "mime") + (public "much") + (public "nixos-infest") + (public "nixpkgs") + (public "painload") + (public "regfish") + (public "repo") + (public "shitment") + (public "wai-middleware-time") + (public "web-routes-wai-custom") + (public "wu-configuration-nix") + ]; + + users = addNames { + tv = { pubkey = readFile ; }; + lass = { pubkey = "xxx"; }; + makefu = { pubkey = "xxx"; }; + }; + + repos = listToAttrs (map ({ repo, ... }: { name = repo.name; value = repo; }) cd-repos); + + rules = concatMap ({ rules, ... }: rules) cd-repos; + + public = repo-name: + rec { + repo = { + name = repo-name; + hooks = { + post-receive = git.irc-announce { + nick = config.networking.hostName; # TODO make this the default + channel = "#retiolum"; + server = "ire.retiolum"; + }; + }; + public = true; + }; + rules = with git; with users; [ + { user = tv; + repo = [ repo ]; + perm = push "refs/*" [ non-fast-forward create delete merge ]; + } + { user = [ lass makefu ]; + repo = [ repo ]; + perm = fetch; + } + ]; + }; + in { @@ -11,49 +68,8 @@ in ../tv/git ]; - services.git = rec { + services.git = { enable = true; - - users = addNames { - tv = { pubkey = readFile ; }; - lass = { pubkey = "xxx"; }; - makefu = { pubkey = "xxx"; }; - }; - - repos = addNames { - shitment = { - desc = "shitment repository"; - hooks = { - post-receive = git.irc-announce { - nick = config.networking.hostName; # TODO make this the default - channel = "#retiolum"; - server = "ire.retiolum"; - }; - }; - public = true; - }; - testing = { - desc = "testing repository"; - hooks = { - post-receive = git.irc-announce { - nick = config.networking.hostName; # TODO make this the default - channel = "#retiolum"; - server = "ire.retiolum"; - }; - }; - public = true; - }; - }; - - rules = with git; with users; with repos; [ - { user = tv; - repo = [ testing shitment ]; - perm = push "refs/*" [ non-fast-forward create delete merge ]; - } - { user = [ lass makefu ]; - repo = [ testing shitment ]; - perm = fetch; - } - ]; + inherit repos rules users; }; }