summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2024-07-27 10:26:37 +1000
committerMichael Hoang <enzime@users.noreply.github.com>2024-07-27 10:26:37 +1000
commit5c8fb551822a137848a666472a17aeb651ee033d (patch)
treee060fa61aeb07d6def1043955c098e3e91ec7d45
parent72bbc11aedcaba6f9a748786bb0aff9213d8fb36 (diff)
Revert "github-runnners: fix workDir missing on reboot"
This reverts commit fe99aa9699e7dd4ce6a81a8a623d010cedbe7eef.
-rw-r--r--modules/services/github-runner/service.nix18
1 files changed, 6 insertions, 12 deletions
diff --git a/modules/services/github-runner/service.nix b/modules/services/github-runner/service.nix
index 2fc133f..53f2cdd 100644
--- a/modules/services/github-runner/service.nix
+++ b/modules/services/github-runner/service.nix
@@ -41,7 +41,7 @@ in
in
{
launchd = mkIf cfg.enable {
- text = mkBefore ''
+ text = mkBefore (''
echo >&2 "setting up GitHub Runner '${cfg.name}'..."
${pkgs.coreutils}/bin/mkdir -p -m 0750 ${escapeShellArg (mkStateDir cfg)}
@@ -49,7 +49,10 @@ in
${pkgs.coreutils}/bin/mkdir -p -m 0750 ${escapeShellArg (mkLogDir cfg)}
${pkgs.coreutils}/bin/chown ${user}:${group} ${escapeShellArg (mkLogDir cfg)}
- '';
+ '' + optionalString (cfg.workDir == null) ''
+ ${pkgs.coreutils}/bin/mkdir -p -m 0750 ${escapeShellArg (mkWorkDir cfg)}
+ ${pkgs.coreutils}/bin/chown ${user}:${group} ${escapeShellArg (mkWorkDir cfg)}
+ '');
};
}));
@@ -59,9 +62,6 @@ in
stateDir = mkStateDir cfg;
logDir = mkLogDir cfg;
workDir = mkWorkDir cfg;
- user = if (cfg.user != null) then cfg.user else "_github-runner";
- # If both user and group are null then we manage the group, otherwise if only group is null then there's no group
- group = if (cfg.group != null) then group else if (cfg.user == null) then "_github-runner" else "";
in
nameValuePair
(mkSvcName name)
@@ -116,12 +116,6 @@ in
''
echo "Configuring GitHub Actions Runner"
- ${optionalString (cfg.workDir == null) ''
- # /var/run gets cleared every reboot so we need to create it before starting the service
- ${pkgs.coreutils}/bin/mkdir -p -m 0750 ${escapeShellArg workDir}
- ${pkgs.coreutils}/bin/chown ${user}:${group} ${escapeShellArg workDir}
- ''}
-
# Always clean the working directory
${pkgs.findutils}/bin/find ${escapeShellArg workDir} -mindepth 1 -delete
@@ -153,7 +147,7 @@ in
StandardErrorPath = "${logDir}/launchd-stderr.log";
StandardOutPath = "${logDir}/launchd-stdout.log";
ThrottleInterval = 30;
- UserName = user;
+ UserName = if (cfg.user != null) then cfg.user else "_github-runner";
WatchPaths = [
"/etc/resolv.conf"
"/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist"