From 066902e37a781ced440f7fc20519a90c4aa3b732 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Thu, 15 Aug 2024 03:49:52 -0600 Subject: [PATCH] Actions runner runs as kat --- nix-darwin/flake.nix | 1 + nix-darwin/gitea-actions-runner.nix | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nix-darwin/flake.nix b/nix-darwin/flake.nix index 0fd30ff0..10cf0de6 100644 --- a/nix-darwin/flake.nix +++ b/nix-darwin/flake.nix @@ -30,6 +30,7 @@ networking.hostName = "mac-demarco-mini"; imports = [ (import ./gitea-actions-runner.nix) ]; services.gitea-actions-runner = { + user = "kat"; instances.nix = { enable = true; name = config.networking.hostName; diff --git a/nix-darwin/gitea-actions-runner.nix b/nix-darwin/gitea-actions-runner.nix index cd416756..e4ac0c9e 100644 --- a/nix-darwin/gitea-actions-runner.nix +++ b/nix-darwin/gitea-actions-runner.nix @@ -112,11 +112,8 @@ in { } ]; - # Create the user and group users.users.${cfg.user} = { name = cfg.user; - home = "/var/lib/gitea-runner"; - createHome = true; description = "Gitea Actions Runner user"; }; @@ -127,6 +124,7 @@ in { serviceConfig = { ProgramArguments = [ "${pkgs.writeShellScript "gitea-runner-start-${name}" '' + sudo su - ${cfg.user} export HOME="/var/lib/gitea-runner/${name}" mkdir -p "$HOME" cd "$HOME" @@ -144,7 +142,7 @@ in { # Start the runner exec ${cfg.package}/bin/act_runner daemon --config ${settingsFormat.generate "config.yaml" instance.settings} - '' + ''}" ]; KeepAlive = true; RunAtLoad = true; @@ -152,7 +150,6 @@ in { StandardOutPath = "/var/log/gitea-runner/${name}.log"; StandardErrorPath = "/var/log/gitea-runner/${name}.error.log"; UserName = cfg.user; - GroupName = cfg.group; EnvironmentVariables = { PATH = (lib.makeBinPath (instance.hostPackages ++ [ cfg.package ])) + ":/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"; } // optionalAttrs (instance.token != null) {