diff options
-rw-r--r-- | krebs/3modules/backup.nix | 8 | ||||
-rw-r--r-- | krebs/3modules/repo-sync.nix | 2 | ||||
-rw-r--r-- | tv/2configs/repo-sync/wiki.nix | 41 |
3 files changed, 48 insertions, 3 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix index c0b218c15..910324f3c 100644 --- a/krebs/3modules/backup.nix +++ b/krebs/3modules/backup.nix @@ -226,10 +226,14 @@ let # XXX Is one ping enough to determine fastest address? fastest-address = host: '' - { ${pkgs.fping}/bin/fping </dev/null -a \ + { ${pkgs.fping}/bin/fping </dev/null -a -e \ ${concatMapStringsSep " " shell.escape (mapAttrsToList (_: net: head net.aliases) host.nets)} \ - | ${pkgs.coreutils}/bin/head -1; } + | ${pkgs.gnused}/bin/sed -r 's/^(\S+) \(([0-9.]+) ms\)$/\2\t\1/' \ + | ${pkgs.coreutils}/bin/sort -n \ + | ${pkgs.coreutils}/bin/cut -f2 \ + | ${pkgs.coreutils}/bin/head -n 1 + } ''; in out diff --git a/krebs/3modules/repo-sync.nix b/krebs/3modules/repo-sync.nix index 91111f3eb..f9877c0f8 100644 --- a/krebs/3modules/repo-sync.nix +++ b/krebs/3modules/repo-sync.nix @@ -176,7 +176,7 @@ let ]; environment = { - GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.stateDir}/ssh.priv"; + GIT_SSH_COMMAND = "${pkgs.openssh}/bin/ssh -i ${cfg.privateKeyFile.path}"; REPONAME = "${name}.git"; }; diff --git a/tv/2configs/repo-sync/wiki.nix b/tv/2configs/repo-sync/wiki.nix new file mode 100644 index 000000000..913439906 --- /dev/null +++ b/tv/2configs/repo-sync/wiki.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: let + lib = import <stockholm/lib>; +in { + krebs.repo-sync.enable = true; + krebs.repo-sync.repos.wiki.branches.hotdog = { + origin.url = "http://cgit.hotdog.r/wiki"; + mirror.url = "git@${config.krebs.build.host.name}.r:wiki"; + }; + krebs.git.repos.wiki = { + public = true; + name = "wiki"; + cgit.desc = toString [ + "mirror of" + config.krebs.repo-sync.repos.wiki.branches.hotdog.origin.url + ]; + cgit.section = "7. mirrors"; + hooks.post-receive = /* sh */ '' + ${pkgs.git-hooks.irc-announce { + channel = "#xxx"; + nick = config.krebs.build.host.name; + server = "irc.r"; + }} + ${pkgs.cgit-clear-cache.override { + inherit (config.krebs.git.cgit.settings) cache-root; + }}/bin/cgit-clear-cache + ''; + }; + krebs.git.rules = lib.singleton { + user = lib.singleton config.krebs.users.repo-sync; + repo = lib.singleton config.krebs.git.repos.wiki; + perm = lib.git.push "refs/*" [ + lib.git.create + lib.git.delete + lib.git.merge + lib.git.non-fast-forward + ]; + }; + krebs.users.${config.krebs.repo-sync.user.name}.pubkey = { + ni = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK9U0Ob9/O0kxg3trhZY/vDnbqfN+R5cASGiClRr4IM"; + }.${config.krebs.build.host.name}; +} |