2022-02-16 19:30:17 +01:00
|
|
|
# Configures the public josh instance for serving the depot.
|
2021-09-16 17:46:17 +02:00
|
|
|
{ config, depot, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2022-02-16 19:34:18 +01:00
|
|
|
cfg = config.services.depot.josh;
|
2022-01-30 17:06:58 +01:00
|
|
|
in
|
|
|
|
{
|
2022-02-16 19:34:18 +01:00
|
|
|
options.services.depot.josh = with lib; {
|
|
|
|
enable = mkEnableOption "Enable josh for serving the depot";
|
2021-09-16 17:46:17 +02:00
|
|
|
|
2022-02-16 19:34:18 +01:00
|
|
|
port = mkOption {
|
2021-09-16 17:46:17 +02:00
|
|
|
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";
|
2024-04-18 15:15:46 +02:00
|
|
|
ExecStart = "${pkgs.josh}/bin/josh-proxy --no-background --local /var/lib/josh --port ${toString cfg.port} --remote https://cl.tvl.fyi/ --require-auth";
|
2021-09-16 17:46:17 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|