summaryrefslogtreecommitdiffstats
path: root/lass/2configs/repo-sync.nix
blob: bb5123a02a3e0958775ad63bbdee1bebdd0d58cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ config, lib, pkgs, ... }:

with config.krebs.lib;

let
  mirror = "git@${config.networking.hostName}:";

  sync = name: let
    repo = {
      public = true;
      name = mkDefault "${name}";
      cgit.desc = mkDefault "mirror for all ${name} branches";
      hooks = mkDefault {
        post-receive = pkgs.git-hooks.irc-announce {
          nick = config.networking.hostName;
          verbose = false;
          channel = "#retiolum";
          server = "cd.retiolum";
        };
      };
    };
  in {
    krebs.repo-sync.repos.${name} = {
      makefu = {
        origin.url = "http://cgit.gum/${name}";
        mirror.url = "${mirror}${name}";
      };
      tv = {
        origin.url = "http://cgit.cd/${name}";
        mirror.url = "${mirror}${name}";
      };
      lassulus = {
        origin.url = "http://cgit.prism/${name}";
        mirror.url = "${mirror}${name}";
      };
      "@latest" = {
        mirror.url = "${mirror}${name}";
        mirror.ref = "heads/newest";
      };
    };
    krebs.git = {
      rules = with git; singleton {
        user = [ config.krebs.users."${config.networking.hostName}-repo-sync" ];
        repo = [ repo ];
        perm = push ''refs/*'' [ non-fast-forward create delete merge ];
      };
      repos."${name}" = repo;
    };
  };

in {
  krebs.repo-sync = {
    enable = true;
    privateKeyFile = toString <secrets/repo-sync.key>;
  };
  imports = [
    (sync "stockholm")
    (sync "realwallpaper")
    (sync "xmonad-stockholm")
    (sync "newsbot-js")
    (sync "go")
    (sync "wai-middleware-time")
    (sync "web-routes-wai-custom")
    (sync "much")
    (sync "painload")
  ];
}