environment

This commit is contained in:
2026-02-07 13:46:35 -07:00
parent d8ab3f161f
commit 0ce24bad4e

View File

@@ -34,33 +34,34 @@
"/bin" "/bin"
]; ];
# Make sure the user exists FIRST
users.users.gitea-runner = { users.users.gitea-runner = {
isNormalUser = true; isNormalUser = true;
description = "Gitea Actions Runner"; description = "Gitea Actions Runner";
home = "/home/gitea-runner"; home = "/home/gitea-runner";
createHome = true; createHome = true;
group = "gitea-runner";
extraGroups = [ "docker" ]; extraGroups = [ "docker" ];
packages = with pkgs; [ packages = with pkgs; [
kubernetes-helm kubernetes-helm
]; ];
shell = pkgs.bash; shell = pkgs.bash;
}; };
users.groups.gitea-runner = { }; users.groups.gitea-runner = { };
# Ensure proper permissions on the token file
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /data/runner 0755 gitea-runner gitea-runner -" "d /data/runner 0755 gitea-runner gitea-runner -"
"f /data/runner/gitea-infrastructure-token.txt 0600 gitea-runner gitea-runner -" "f /data/runner/gitea-infrastructure-token.txt 0600 gitea-runner gitea-runner -"
]; ];
# Completely disable all sandboxing
systemd.services.gitea-runner-infrastructure.serviceConfig = { systemd.services.gitea-runner-infrastructure.serviceConfig = {
# Your existing paths - but also add state directory ReadWritePaths = lib.mkForce [ ];
ReadWritePaths = lib.mkForce [ ]; # Empty - no restrictions
StateDirectory = lib.mkForce "gitea-runner-infrastructure"; StateDirectory = lib.mkForce "gitea-runner-infrastructure";
StateDirectoryMode = lib.mkForce "0755"; StateDirectoryMode = lib.mkForce "0755";
# ADD THIS - set the working directory
WorkingDirectory = lib.mkForce "/var/lib/gitea-runner-infrastructure/infrastructure";
# Disable all sandboxing features # Disable all sandboxing features
DynamicUser = lib.mkForce false; DynamicUser = lib.mkForce false;
PrivateDevices = lib.mkForce false; PrivateDevices = lib.mkForce false;
@@ -85,11 +86,9 @@
SystemCallFilter = lib.mkForce [ ]; SystemCallFilter = lib.mkForce [ ];
RestrictAddressFamilies = lib.mkForce [ ]; RestrictAddressFamilies = lib.mkForce [ ];
# Ensure it runs as your existing user
User = lib.mkForce "gitea-runner"; User = lib.mkForce "gitea-runner";
Group = lib.mkForce "gitea-runner"; Group = lib.mkForce "gitea-runner";
# Allow access to devices
DeviceAllow = lib.mkForce [ ]; DeviceAllow = lib.mkForce [ ];
DevicePolicy = lib.mkForce "auto"; DevicePolicy = lib.mkForce "auto";