diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cd/git.nix | 88 |
1 files changed, 52 insertions, 36 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,39 +1,45 @@ { 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; -in -{ - imports = [ - ../tv/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") ]; - services.git = rec { - enable = true; + users = addNames { + tv = { pubkey = readFile <pubkeys/tv.ssh.pub>; }; + lass = { pubkey = "xxx"; }; + makefu = { pubkey = "xxx"; }; + }; - users = addNames { - tv = { pubkey = readFile <pubkeys/tv.ssh.pub>; }; - lass = { pubkey = "xxx"; }; - makefu = { pubkey = "xxx"; }; - }; + repos = listToAttrs (map ({ repo, ... }: { name = repo.name; value = repo; }) cd-repos); - 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"; + 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 @@ -43,17 +49,27 @@ in }; 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; + } + ]; }; - 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; - } - ]; +in + +{ + imports = [ + ../tv/git + ]; + + services.git = { + enable = true; + inherit repos rules users; }; } |