Home

infra @0f326ee206c6424098f13b738ae51a8009bc16a1 - refs - log -
-
https://git.jolheiser.com/infra.git
dragonwell flake
infra / dragonwell / gollum.nix
- raw -
 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
{ pkgs, config, ... }:
{
  services.gollum = {
    enable = true;
    stateDir = "/var/lib/ugit/repos/wiki.git";
    emoji = true;
    h1-title = true;
    port = 9454;
    branch = "main";
    user = "ugit";
    group = "ugit";
  };

  # Hack to work with bare repos
  systemd.services.gollum =
    let
      cfg = config.services.gollum;
    in
    {
      preStart = pkgs.lib.mkForce ''
        git init --bare ${cfg.stateDir}
      '';
      serviceConfig.ExecStart = pkgs.lib.mkForce ''
        ${cfg.package}/bin/gollum \
              --port ${toString cfg.port} \
              --host ${cfg.address} \
              --config ${pkgs.writeText "gollum-config.rb" cfg.extraConfig} \
              --ref ${cfg.branch} \
              ${pkgs.lib.optionalString cfg.math "--math"} \
              ${pkgs.lib.optionalString cfg.emoji "--emoji"} \
              ${pkgs.lib.optionalString cfg.h1-title "--h1-title"} \
              ${pkgs.lib.optionalString cfg.no-edit "--no-edit"} \
              ${pkgs.lib.optionalString (cfg.allowUploads != null) "--allow-uploads ${cfg.allowUploads}"} \
              ${pkgs.lib.optionalString (cfg.user-icons != null) "--user-icons ${cfg.user-icons}"} \
              --bare \
              --css \
              --js \
              ${cfg.stateDir}
      '';
    };
}