stockholm/old/modules/mors/git.nix

131 lines
2.9 KiB
Nix
Raw Normal View History

2015-06-18 22:45:56 +00:00
{ config, lib, pkgs, ... }:
2015-07-13 11:39:49 +00:00
let
inherit (builtins) map readFile;
inherit (lib) concatMap listToAttrs;
# TODO lib should already include our stuff
inherit (import ../../lib { inherit lib pkgs; }) addNames git;
x-repos = [
(krebs-private "brain")
(public "painload")
(public "shitment")
(public "wai-middleware-time")
(public "web-routes-wai-custom")
(secret "pass")
(tv-lass "emse-drywall")
(tv-lass "emse-hsdb")
2015-06-18 22:45:56 +00:00
];
2015-07-13 11:39:49 +00:00
users = addNames {
tv = { pubkey = readFile <pubkeys/tv_wu.ssh.pub>; };
lass = { pubkey = readFile <pubkeys/lass.ssh.pub>; };
uriel = { pubkey = readFile <pubkeys/uriel.ssh.pub>; };
makefu = { pubkey = "xxx"; };
};
2015-06-18 22:45:56 +00:00
2015-07-13 11:39:49 +00:00
repos = listToAttrs (map ({ repo, ... }: { name = repo.name; value = repo; }) x-repos);
2015-06-18 22:45:56 +00:00
2015-07-13 11:39:49 +00:00
rules = concatMap ({ rules, ... }: rules) x-repos;
2015-06-18 22:45:56 +00:00
2015-07-13 11:39:49 +00:00
krebs-private = 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";
2015-06-18 22:45:56 +00:00
};
};
2015-07-13 11:39:49 +00:00
};
rules = with git; with users; [
{ user = lass;
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
}
{ user = [ tv makefu uriel ];
repo = [ repo ];
perm = fetch;
}
];
};
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";
2015-06-18 22:45:56 +00:00
};
};
2015-07-13 11:39:49 +00:00
public = true;
};
rules = with git; with users; [
{ user = lass;
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
}
{ user = [ tv makefu uriel ];
repo = [ repo ];
perm = fetch;
}
];
};
secret = repo-name:
rec {
repo = {
name = repo-name;
hooks = {};
2015-06-18 22:45:56 +00:00
};
2015-07-13 11:39:49 +00:00
rules = with git; with users; [
{ user = lass;
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
}
{ user = [ uriel ];
repo = [ repo ];
perm = fetch;
}
];
};
2015-06-18 22:45:56 +00:00
2015-07-13 11:39:49 +00:00
tv-lass = repo-name:
rec {
repo = {
name = repo-name;
hooks = {};
};
rules = with git; with users; [
2015-06-18 22:45:56 +00:00
{ user = lass;
2015-07-13 11:39:49 +00:00
repo = [ repo ];
perm = push "refs/*" [ non-fast-forward create delete merge ];
2015-06-18 22:45:56 +00:00
}
2015-07-13 11:39:49 +00:00
{ user = [ tv ];
repo = [ repo ];
2015-06-18 22:45:56 +00:00
perm = fetch;
}
];
};
2015-07-13 11:39:49 +00:00
in
{
imports = [
../tv/git
];
tv.git = {
enable = true;
inherit repos rules users;
};
2015-06-18 22:45:56 +00:00
}