remote-builder

This commit is contained in:
Motiejus Jakštys 2024-02-25 20:04:21 +02:00
parent 731f0155d6
commit 861d4e81fc
4 changed files with 46 additions and 0 deletions

View File

@ -16,6 +16,8 @@ rec {
jakstpub = 505; jakstpub = 505;
photoprism = 507; photoprism = 507;
remote-builder = 508;
}; };
ports = { ports = {

View File

@ -70,6 +70,16 @@
sshguard.enable = true; sshguard.enable = true;
tailscale.enable = true; tailscale.enable = true;
remote-builder = {
enable = true;
uidgid = myData.uidgid.remote-builder;
sshAllowSubnet = myData.subnets.tailscale.sshPattern;
publicKeys = map (h: myData.hosts.${h}.publicKey) [
"vno1-oh2.servers.jakst"
"fwminex.motiejus.jakst"
];
};
postfix = { postfix = {
enable = true; enable = true;
saslPasswdPath = config.age.secrets.sasl-passwd.path; saslPasswdPath = config.age.secrets.sasl-passwd.path;

View File

@ -11,6 +11,7 @@
./node_exporter ./node_exporter
./nsd-acme ./nsd-acme
./postfix ./postfix
./remote-builder
./snmp_exporter ./snmp_exporter
./sshguard ./sshguard
./syncthing ./syncthing

View File

@ -0,0 +1,33 @@
{
config,
lib,
...
}: let
cfg = config.mj.services.remote-builder;
in {
options.mj.services.remote-builder = with lib.types; {
enable = lib.mkEnableOption "Enable remote builder";
uidgid = lib.mkOption {type = int;};
sshAllowSubnet = lib.mkOption {type = str;};
publicKeys = lib.mkOption {type = listOf str;};
};
config = lib.mkIf cfg.enable {
users.users.remote-builder = {
description = "Remote Builder";
home = "/var/lib/remote-builder";
shell = "/bin/sh";
group = "remote-builder";
isSystemUser = true;
createHome = true;
uid = cfg.uidgid;
openssh.authorizedKeys.keys =
map (
k: "from=\"${cfg.sshAllowSubnet}\" ${k}"
)
cfg.publicKeys;
};
users.groups.remote-builder.gid = cfg.uidgid;
nix.settings.trusted-users = ["remote-builder"];
};
}