[mcp] Fixes users for some containers.

This commit is contained in:
2025-04-28 16:22:00 -07:00
parent 509c861529
commit 60a6cf8e89
2 changed files with 12 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ in {
image = "offen/offen"; image = "offen/offen";
hostName = "offen"; hostName = "offen";
domain = terakoda; domain = terakoda;
user = "offen:offen"; user = "${toString config.users.users.offen.uid}:${toString config.users.groups.offen.gid}";
port = 80; port = 80;
volumes = [ volumes = [
"${config.sops.templates."offen.env".path}:/etc/offen/offen.env:ro" "${config.sops.templates."offen.env".path}:/etc/offen/offen.env:ro"

View File

@@ -13,27 +13,22 @@
public-html = { public-html = {
uid = 2008; uid = 2008;
shell = "${pkgs.git}/bin/git-shell"; shell = "${pkgs.git}/bin/git-shell";
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKPiqbLAXpBkjXnHLvz3VCd5i+VmYdd9dAcRt+8E1OQX drew@vega"
];
home = "/tank/web";
}; };
}; };
mkUser = name: value: let mkUser = name: value: {
uid = uid = value.uid or value;
if builtins.isInt value isSystemUser = true; # only affects UID allocation, but required
then value
else value.uid;
shell =
if builtins.isAttrs value && builtins.hasAttr "shell" value
then value.shell
else null;
extraGroups =
if builtins.isAttrs value && builtins.hasAttr "extraGroups" value
then value.extraGroups
else [];
in {
inherit uid shell extraGroups;
isSystemUser = true;
description = "System User for ${name}"; description = "System User for ${name}";
group = "${name}"; group = "${name}";
shell = value.shell or null;
extraGroups = value.extraGroups or [];
openssh.authorizedKeys.keys = value.authorizedKeys or [];
home = value.home or "/var/empty";
}; };
mkGroup = name: value: let mkGroup = name: value: let
# 1. Value if int # 1. Value if int