fix(nixos): add operator to homelab-operators and configure daemon systemd sandbox
Core Architecture & Invariant CI / validate (pull_request) Failing after 1m2s

Closes #4
This commit is contained in:
kiskaadee committed 2026-10-19 15:38:59 -05:00
1 parent 0b5ba58ecf
commit 2668dcc5a8
3 files changed
+11 -6

No files matched your search

+4 -3
View File
@@ -63,9 +63,10 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICAVPPMk+WApUd/fo78+lsRGnLKSlY4GDZiNGKwBAifD" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICAVPPMk+WApUd/fo78+lsRGnLKSlY4GDZiNGKwBAifD"
]; ];
extraGroups = [ extraGroups = [
"wheel" # sudo access "wheel" # sudo access
"docker" # run docker without sudo "docker" # run docker without sudo
"networkmanager" # modify network settings "homelab-operators" # access /run/homelab/appctl.sock
"networkmanager" # modify network settings
]; ];
}; };
+6 -2
View File
@@ -109,7 +109,7 @@
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
User = config.homelab.operatorUser; User = config.homelab.operatorUser;
SupplementaryGroups = [ "docker" ]; SupplementaryGroups = [ "docker" "homelab-operators" ];
WorkingDirectory = config.homelab.coreDir; WorkingDirectory = config.homelab.coreDir;
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [ ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
{ {
@@ -137,12 +137,13 @@
ReadWritePaths = [ ReadWritePaths = [
config.homelab.sitesDir config.homelab.sitesDir
"/home/${config.homelab.operatorUser}/.local/state/homelab" "/home/${config.homelab.operatorUser}/.local/state/homelab"
"/run/homelab"
]; ];
}; };
}; };
# Declarative Users and Groups for Control Plane Service Identity # Declarative Users and Groups for Control Plane Service Identity
users.groups.homelab-operators = {}; users.groups.homelab-operators.members = [ config.homelab.operatorUser ];
users.users.homelab-appctl = { users.users.homelab-appctl = {
isSystemUser = true; isSystemUser = true;
group = "homelab-operators"; group = "homelab-operators";
@@ -168,6 +169,9 @@
]; ];
environment = { environment = {
HOME = "/var/lib/homelab/appctl";
DOCKER_CONFIG = "/var/lib/homelab/appctl/.docker";
HOMELAB_DOMAIN = config.homelab.domain;
APPCTL_SOCKET_PATH = "/run/homelab/appctl.sock"; APPCTL_SOCKET_PATH = "/run/homelab/appctl.sock";
APPCTL_HTTP_HOST = "127.0.0.1"; APPCTL_HTTP_HOST = "127.0.0.1";
APPCTL_HTTP_PORT = "9001"; APPCTL_HTTP_PORT = "9001";
+1 -1
View File
@@ -484,7 +484,7 @@ class AppctlDaemon:
try: try:
os.chmod(self.socket_path, 0o660) os.chmod(self.socket_path, 0o660)
except OSError as e: except OSError as e:
logger.warning("Could not set mode 0660 on socket %s: %e", self.socket_path, e) logger.warning("Could not set mode 0660 on socket %s: %s", self.socket_path, e)
# 2. Prepare and bind TCP listener # 2. Prepare and bind TCP listener
self.tcp_server = ThreadingHTTPServer((self.http_host, self.http_port), AppctlHTTPHandler) self.tcp_server = ThreadingHTTPServer((self.http_host, self.http_port), AppctlHTTPHandler)