From d61398c188205c1fca3bc3fd64de67c45632477d Mon Sep 17 00:00:00 2001 From: vkcku Date: Tue, 2 Jun 2026 08:44:31 +0530 Subject: infra: allow storing private and public monorepo on separate servers monorepo-revid: 4713f0955189016bf937059892ab9c40e224bd84 --- infra/modules/gitserver.nix | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'infra/modules') diff --git a/infra/modules/gitserver.nix b/infra/modules/gitserver.nix index 3cacb54..f675d2d 100644 --- a/infra/modules/gitserver.nix +++ b/infra/modules/gitserver.nix @@ -18,9 +18,16 @@ default = "git"; }; - monorepoDir = lib.mkOption { - type = lib.types.str; - description = "The directory that contains the monorepo."; + enablePrivate = lib.mkOption { + type = lib.types.bool; + description = "Whether to enable storing the private monorepo."; + default = false; + }; + + enablePublic = lib.mkOption { + type = lib.types.bool; + description = "Whether to enable storing the public monorepo."; + default = false; }; }; @@ -29,8 +36,6 @@ "${workingDirectory}" ]; - infra.gitserver.monorepoDir = "${workingDirectory}/monorepo"; - users = { groups."${cfg.user}" = { }; users."${cfg.user}" = { @@ -57,13 +62,17 @@ path = [ pkgs.git ]; enableStrictShellChecks = true; script = '' - if [ ! -d "${cfg.monorepoDir}" ]; then - git init --bare monorepo - fi + ${lib.optionalString cfg.enablePrivate '' + if [ ! -d "${workingDirectory}/monorepo" ]; then + git init --bare monorepo + fi + ''} - if [ ! -d "${workingDirectory}/monorepo-public" ]; then - git init --bare monorepo-public - fi + ${lib.optionalString cfg.enablePublic '' + if [ ! -d "${workingDirectory}/monorepo-public" ]; then + git init --bare monorepo-public + fi + ''} ''; }; @@ -72,8 +81,11 @@ assertion = config.infra.tailscale.ssh; message = "Tailscale SSH must be enabled when using gitserver."; } + { + assertion = config.infra.gitserver.enablePrivate || config.infra.gitserver.enablePublic; + message = "either the private or public monorepo must be enabled in gitserver"; + } ]; - }; }; } -- cgit v1.3.1