aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infra/hosts/plato/plato.nix2
-rw-r--r--infra/modules/gitserver.nix36
2 files changed, 26 insertions, 12 deletions
diff --git a/infra/hosts/plato/plato.nix b/infra/hosts/plato/plato.nix
index e8a534e..920c14d 100644
--- a/infra/hosts/plato/plato.nix
+++ b/infra/hosts/plato/plato.nix
@@ -15,6 +15,8 @@ in
];
infra = {
+ gitserver.enablePrivate = true;
+
tailscale = {
authenticate = true;
ssh = true;
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";
+ }
];
-
};
};
}