Change:
Working with large repositories on low-memory systems (such as aarch64-linux SBCs) can lead to out-of-storage scenarios with the github-runner service because the working directory is set to by default , which is sized to 25% of the system memory by default . Ideally there can be an option to use storage instead of memory for the working directory. I'm opening an issue first because I am not sure if there is a way to work around this already; can the argument in the service be overridden, or is there another way to change for this service with a systemd setting? If there isn't a straightforward solution I can open a PR to add this as an option. Maintainers:
I also experienced issues with no space left on . So far, however, increasing its size did the job. Nevertheless, I'd also appreciate the option to use another filesystem for the runtime directory. We won't be able to use systemd for that as it demands a -like filesystem for the runtime directory.
I guess standard installs avoid this by using the directory. Maybe we should just document how increase size instead of adding another option?
You may pass an arbitrary path to the options of the configuration script. Our module currently always uses the runtime directory systemd assigns to the service.
Yeah, in our case using the runtime directory that provides makes the most sense for dynamic user, again, with documentation on how to increase the size of the runtime directory. Currently our module doesn't support static users so isn't very useful... though I'm guessing our lack of support for static users is an oversight - see details here:

Discussion:
default = null; defaultText = literalExpression "username"; }; <ins> workDir = mkOption { type = with types; nullOr str; description = lib.mdDoc '' Working directory, available as `$GITHUB_WORKSPACE` during workflow runs and used as a default for [repository checkouts](https://github.com/actions/checkout). The service cleans this directory on every service start. A value of `null` will default to the systemd `RuntimeDirectory`. ''; default = null; }; </ins> }

with lib; <ins> let workDir = if cfg.workDir == null then runtimeDir else cfg.workDir; in </ins> { description = "GitHub Actions runner";

after = [ "network.target" "network-online.target" ]; environment = { <del> HOME = runtimeDir; </del> <ins> HOME = workDir; </ins> RUNNER_ROOT = stateDir; } // cfg.extraEnvironment;

config.nix.package ] ++ cfg.extraPackages; <del> serviceConfig = rec { </del> <ins> serviceConfig = { </ins> ExecStart = "${cfg.package}/bin/Runner.Listener run --startuptype service"; # Does the following, sequentially:

# - Set up the directory structure by creating the necessary symlinks. ExecStartPre = let <del> # Wrapper script which expects the full path of the state, runtime and logs </del> <ins> # Wrapper script which expects the full path of the state, working and logs </ins> # directory as arguments. Overrides the respective systemd variables to provide # unambiguous directory names. This becomes relevant, for example, if the # caller overrides any of the StateDirectory=, RuntimeDirectory= or LogDirectory=

set -euo pipefail STATE_DIRECTORY="$1" <del> RUNTIME_DIRECTORY="$2" </del> <ins> WORK_DIRECTORY="$2" </ins> LOGS_DIRECTORY="$3" ${lines} ''; <del> runnerRegistrationConfig = getAttrs [ "name" "tokenFile" "url" "runnerGroup" "extraLabels" "ephemeral" ] cfg; </del> <ins> runnerRegistrationConfig = getAttrs [ "name" "tokenFile" "url" "runnerGroup" "extraLabels" "ephemeral" "workDir" ] cfg; </ins> newConfigPath = builtins.toFile "${svcName}-config.json" (builtins.toJSON runnerRegistrationConfig); currentConfigPath = "$STATE_DIRECTORY/.nixos-current-config.json"; newConfigTokenPath= "$STATE_DIRECTORY/.new-token";

else # The state directory is entirely empty which indicates a first start copy_tokens <del> fi        ''; </del> <ins> fi ''; </ins> configureRunner = writeScript "configure" '' if [[ -e "${newConfigTokenPath}" ]]; then echo "Configuring GitHub Actions Runner" args=( --unattended --disableupdate <del> --work "$RUNTIME_DIRECTORY" </del> <ins> --work "$WORK_DIRECTORY" </ins> --url ${escapeShellArg cfg.url} --labels ${escapeShellArg (concatStringsSep "," cfg.extraLabels)} --name ${escapeShellArg cfg.name}

ln -s '${newConfigPath}' "${currentConfigPath}" fi ''; <del> setupRuntimeDir = writeScript "setup-runtime-dirs" '' </del> <ins> setupWorkDir = writeScript "setup-work-dirs" '' # Cleanup previous service ${pkgs.findutils}/bin/find -H "$WORK_DIRECTORY" -mindepth 1 -delete </ins> # Link _diag dir <del> ln -s "$LOGS_DIRECTORY" "$RUNTIME_DIRECTORY/_diag" </del> <ins> ln -s "$LOGS_DIRECTORY" "$WORK_DIRECTORY/_diag" </ins> <del> # Link the runner credentials to the runtime dir ln -s "$STATE_DIRECTORY"/{${lib.concatStringsSep "," runnerCredFiles}} "$RUNTIME_DIRECTORY/" </del> <ins> # Link the runner credentials to the work dir ln -s "$STATE_DIRECTORY"/{${lib.concatStringsSep "," runnerCredFiles}} "$WORK_DIRECTORY/" </ins> ''; in <del> map (x: "${x} ${escapeShellArgs [ stateDir runtimeDir logsDir ]}") [ </del> <ins> map (x: "${x} ${escapeShellArgs [ stateDir workDir logsDir ]}") [ </ins> "+${unconfigureRunner}" # runs as root configureRunner <del> setupRuntimeDir </del> <ins> setupWorkDir </ins> ]; # If running in ephemeral mode, restart the service on-exit (i.e., successful de-registration of the runner)

# Home of persistent runner data, e.g., credentials StateDirectory = [ systemdDir ]; StateDirectoryMode = "0700"; <del> WorkingDirectory = runtimeDir; </del> <ins> WorkingDirectory = workDir; </ins> InaccessiblePaths = [ # Token file path given in the configuration, if visible to the service

]; RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" "AF_NETLINK" ]; <ins> BindPaths = lib.optionals (cfg.workDir != null) [ cfg.workDir ]; </ins> # Needs network access PrivateNetwork = false; # Cannot be true due to Node