2016-02-15 13:03:47 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2023-06-10 10:50:53 +00:00
|
|
|
with import ../../lib/pure.nix { inherit lib; };
|
2017-07-22 13:12:06 +00:00
|
|
|
|
|
|
|
let
|
2018-08-29 15:42:00 +00:00
|
|
|
konsens-user = {
|
|
|
|
name = "konsens";
|
|
|
|
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIKKozGNGBAzHnyj6xUlsjGxxknyChXvuyrddkWVVnz7";
|
|
|
|
};
|
2017-07-22 13:12:06 +00:00
|
|
|
mirror = "git@${config.networking.hostName}:";
|
|
|
|
|
2018-08-24 17:34:29 +00:00
|
|
|
defineRepo = {
|
|
|
|
name, desc, section
|
|
|
|
}:
|
|
|
|
let
|
2017-07-22 13:12:06 +00:00
|
|
|
repo = {
|
|
|
|
public = true;
|
|
|
|
name = mkDefault "${name}";
|
2018-08-24 17:34:29 +00:00
|
|
|
cgit.desc = desc;
|
|
|
|
cgit.section = section;
|
|
|
|
hooks = mkDefault {
|
2017-07-22 13:12:06 +00:00
|
|
|
post-receive = pkgs.git-hooks.irc-announce {
|
2017-10-01 12:26:12 +00:00
|
|
|
channel = "#xxx";
|
2018-09-06 21:02:56 +00:00
|
|
|
refs = [
|
|
|
|
"refs/heads/newest"
|
2018-09-06 21:04:24 +00:00
|
|
|
"refs/tags/*"
|
2018-09-06 20:34:33 +00:00
|
|
|
];
|
2018-09-06 21:02:56 +00:00
|
|
|
nick = config.networking.hostName;
|
|
|
|
server = "irc.r";
|
|
|
|
verbose = false;
|
2017-03-07 23:52:31 +00:00
|
|
|
};
|
2018-08-24 17:34:29 +00:00
|
|
|
};
|
2017-07-22 13:12:06 +00:00
|
|
|
};
|
|
|
|
in {
|
2018-08-24 17:34:29 +00:00
|
|
|
rules = with git; [
|
|
|
|
{
|
|
|
|
user = with config.krebs.users; [
|
|
|
|
config.krebs.users."${config.networking.hostName}-repo-sync"
|
|
|
|
lass
|
|
|
|
makefu
|
2018-08-25 10:04:22 +00:00
|
|
|
tv
|
2018-08-24 17:34:29 +00:00
|
|
|
];
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = push ''refs/*'' [ non-fast-forward create delete merge ];
|
|
|
|
}
|
2018-08-29 15:42:00 +00:00
|
|
|
{
|
|
|
|
user = [
|
|
|
|
konsens-user
|
|
|
|
];
|
|
|
|
repo = [ repo ];
|
2023-04-11 20:35:48 +00:00
|
|
|
perm = push "refs/heads/common" [ create merge ];
|
2018-08-29 15:42:00 +00:00
|
|
|
}
|
2018-08-24 17:34:29 +00:00
|
|
|
{
|
|
|
|
user = attrValues config.krebs.users;
|
|
|
|
repo = [ repo ];
|
|
|
|
perm = fetch;
|
|
|
|
}
|
|
|
|
];
|
2017-07-22 13:12:06 +00:00
|
|
|
repos."${name}" = repo;
|
|
|
|
};
|
|
|
|
|
2023-04-11 20:35:48 +00:00
|
|
|
sync-repo = {
|
2018-08-24 17:34:29 +00:00
|
|
|
name,
|
2023-04-11 20:35:48 +00:00
|
|
|
remotes,
|
2018-08-24 17:34:29 +00:00
|
|
|
desc ? "mirror for ${name}",
|
|
|
|
section ? "mirror"
|
|
|
|
}:
|
2017-07-22 13:12:06 +00:00
|
|
|
{
|
|
|
|
krebs.repo-sync.repos.${name} = {
|
2023-04-11 20:35:48 +00:00
|
|
|
branches = (lib.mapAttrs' (user: url: lib.nameValuePair user {
|
|
|
|
origin.url = url;
|
|
|
|
mirror.url = "${mirror}${name}";
|
|
|
|
}) remotes);
|
2017-07-22 13:12:06 +00:00
|
|
|
latest = {
|
|
|
|
url = "${mirror}${name}";
|
2018-08-24 17:34:29 +00:00
|
|
|
ref = "heads/newest";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
krebs.git = defineRepo { inherit name desc section; };
|
|
|
|
};
|
|
|
|
|
2017-07-22 13:12:06 +00:00
|
|
|
in {
|
2017-07-22 18:37:20 +00:00
|
|
|
krebs.git = {
|
2018-08-24 17:34:29 +00:00
|
|
|
enable = true;
|
|
|
|
cgit.settings = {
|
|
|
|
root-title = "krebs repos";
|
|
|
|
root-desc = "keep calm and engage";
|
2017-07-22 18:37:20 +00:00
|
|
|
};
|
|
|
|
};
|
2018-08-24 17:34:29 +00:00
|
|
|
krebs.repo-sync = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2018-08-29 15:42:00 +00:00
|
|
|
krebs.konsens = {
|
|
|
|
enable = true;
|
|
|
|
repos = {
|
|
|
|
stockholm = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
krebs.secret.files.konsens = {
|
|
|
|
path = "/var/lib/konsens/.ssh/id_ed25519";
|
|
|
|
owner = konsens-user;
|
|
|
|
source-path = "${<secrets/konsens.id_ed25519>}";
|
|
|
|
};
|
|
|
|
|
2017-07-22 13:12:06 +00:00
|
|
|
imports = [
|
2023-04-11 20:35:48 +00:00
|
|
|
(sync-repo {
|
|
|
|
name = "stockholm";
|
|
|
|
desc = "take all computers hostage, they love it";
|
|
|
|
section = "configuration";
|
|
|
|
remotes = {
|
|
|
|
makefu = "http://cgit.gum.r/stockholm";
|
|
|
|
tv = "http://cgit.ni.r/stockholm";
|
|
|
|
lassulus = "http://cgit.orange.r/stockholm";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
({ krebs.git = defineRepo {
|
|
|
|
name = "krops";
|
|
|
|
desc = "deployment tools";
|
|
|
|
section = "deployment";
|
|
|
|
};})
|
2017-07-22 13:12:06 +00:00
|
|
|
];
|
2016-02-15 13:03:47 +00:00
|
|
|
}
|