about summary refs log tree commit diff
path: root/ops/modules/josh.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-02-16T18·34+0300
committertazjin <tazjin@tvl.su>2022-02-16T23·03+0000
commitc72c1efdebddd1d8d6c37c8efd360e1c3fcda90b (patch)
treef59ce8a536b7f4f6ac216e5e3e25ca009bf0581f /ops/modules/josh.nix
parentcb8f050b9c6322c060af8580bfdac44fbd13cb5e (diff)
refactor(ops/modules): Rename git-serving -> josh r/3837
cgit has its own module now

Change-Id: I9b4cc322374517b8bd3db43345831e2bf43c4bb1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5295
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'ops/modules/josh.nix')
-rw-r--r--ops/modules/josh.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/ops/modules/josh.nix b/ops/modules/josh.nix
new file mode 100644
index 000000000000..be9e9e966e6b
--- /dev/null
+++ b/ops/modules/josh.nix
@@ -0,0 +1,33 @@
+# Configures the public josh instance for serving the depot.
+{ config, depot, lib, pkgs, ... }:
+
+let
+  cfg = config.services.depot.josh;
+in
+{
+  options.services.depot.josh = with lib; {
+    enable = mkEnableOption "Enable josh for serving the depot";
+
+    port = mkOption {
+      description = "Port on which josh should listen";
+      type = types.int;
+      default = 5674;
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    # Run josh for the depot.
+    systemd.services.josh = {
+      description = "josh - partial cloning of monorepos";
+      wantedBy = [ "multi-user.target" ];
+      path = [ pkgs.git pkgs.bash ];
+
+      serviceConfig = {
+        DynamicUser = true;
+        StateDirectory = "josh";
+        Restart = "always";
+        ExecStart = "${depot.third_party.josh}/bin/josh-proxy --no-background --local /var/lib/josh --port ${toString cfg.port} --remote https://cl.tvl.fyi/";
+      };
+    };
+  };
+}