summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-08-12 19:14:52 +0200
committerlassulus <lassulus@lassul.us>2020-08-12 19:40:42 +0200
commit19cc72be381b5718af90418cff45635f94a2012a (patch)
tree29f152d384430e906522531f9529670c531f2922 /krebs/2configs
parentb63d24d58e1734b986d8e1fa5930e4ba51ddc4bc (diff)
wiki: announce changes in #xxx, serve with cgit
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/wiki.nix64
1 files changed, 62 insertions, 2 deletions
diff --git a/krebs/2configs/wiki.nix b/krebs/2configs/wiki.nix
index 2350e711e..dc6de2efd 100644
--- a/krebs/2configs/wiki.nix
+++ b/krebs/2configs/wiki.nix
@@ -1,9 +1,26 @@
-{ config, ... }:
+{ config, pkgs, ... }:
+with import <stockholm/lib>;
{
- services.gollum = {
+ krebs.gollum = {
enable = true;
+ extraConfig = ''
+ Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
+ system('${toString (pkgs.writers.writeDash "debuglol" ''
+ export PATH=${makeBinPath [ pkgs.git ]}
+ export GIT_SSH_COMMAND='${pkgs.openssh}/bin/ssh -i ${config.krebs.gollum.stateDir}/.ssh/id_ed25519'
+ cd ${config.krebs.gollum.stateDir}
+ if ! url=$(git config remote.origin.url); then
+ git remote add origin git@localhost:gollum
+ elif test "$url" != 'git@localhost:gollum'; then
+ git remote set-url origin git@localhost:gollum
+ fi
+ git push origin master
+ '')}')
+ end
+ '';
};
+
networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = {
enable = true;
@@ -16,4 +33,47 @@
'';
};
};
+
+ krebs.git = {
+ enable = true;
+ cgit.settings = {
+ root-title = "krebs repos";
+ };
+ rules = with git; [
+ {
+ user = [
+ {
+ name = "gollum";
+ pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMXbjDnQWg8EECsNRZZWezocMIiuENhCSQFcFUXcsOQ6";
+ }
+ config.krebs.users.lass-mors
+ ];
+ repo = [ config.krebs.git.repos.gollum ];
+ perm = push ''refs/*'' [ create merge ];
+ }
+ ];
+ repos.gollum = {
+ public = true;
+ name = "gollum";
+ hooks = {
+ post-receive = pkgs.git-hooks.irc-announce {
+ channel = "#xxx";
+ refs = [
+ "refs/heads/master"
+ "refs/heads/newest"
+ "refs/tags/*"
+ ];
+ nick = config.networking.hostName;
+ server = "irc.r";
+ verbose = true;
+ };
+ };
+ };
+ };
+
+ krebs.secret.files.gollum = {
+ path = "${config.krebs.gollum.stateDir}/.ssh/id_ed25519";
+ owner = { name = "gollum"; };
+ source-path = "${<secrets/gollum.id_ed25519>}";
+ };
}