stockholm/modules/cd/git.nix

74 lines
1.7 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
2015-06-18 22:36:27 +00:00
inherit (builtins) map readFile;
inherit (lib) concatMap listToAttrs;
# TODO lib should already include our stuff
inherit (import ../../lib { inherit lib pkgs; }) addNames git;
2015-06-18 22:36:27 +00:00
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 "painload")
(public "regfish")
(public "shitment")
(public "wai-middleware-time")
(public "web-routes-wai-custom")
];
2015-06-18 22:36:27 +00:00
users = addNames {
tv = { pubkey = readFile <pubkeys/tv.ssh.pub>; };
2015-06-18 23:03:17 +00:00
lass = { pubkey = readFile <pubkeys/lass.ssh.pub>; };
uriel = { pubkey = readFile <pubkeys/uriel.ssh.pub>; };
2015-06-18 22:36:27 +00:00
makefu = { pubkey = "xxx"; };
};
2015-06-18 22:36:27 +00:00
repos = listToAttrs (map ({ repo, ... }: { name = repo.name; value = repo; }) cd-repos);
2015-06-18 22:36:27 +00:00
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;
};
2015-06-18 22:36:27 +00:00
rules = with git; with users; [
{ user = tv;
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
}
2015-06-18 23:03:17 +00:00
{ user = [ lass makefu uriel ];
2015-06-18 22:36:27 +00:00
repo = [ repo ];
perm = fetch;
}
];
};
2015-06-18 22:36:27 +00:00
in
{
imports = [
../tv/git
];
services.git = {
enable = true;
inherit repos rules users;
};
}