Skip to content

Commit

Permalink
nixos/github-runner: use specifier to get abs runtime path
Browse files Browse the repository at this point in the history
  • Loading branch information
veehaitch committed Mar 27, 2021
1 parent 91bf483 commit fcfa809
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nixos/modules/services/continuous-integration/github-runner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ with lib;
let
cfg = config.services.github-runner;
svcName = "github-runner";
systemdUser = "${svcName}-${cfg.name}";
systemdDir = "${svcName}/${cfg.name}";
systemdUser = "${svcName}-${cfg.user}";
runnerRoot = "/run/${systemdDir}"; # RuntimeDirectory=
# %t: Runtime directory root (usually /run); see systemd.unit(5)
runtimeDir = "%t/${systemdDir}";
in
{
options.services.github-runner = {
Expand Down Expand Up @@ -111,8 +112,8 @@ in
after = [ "network.target" ];

environment = {
HOME = runnerRoot;
RUNNER_ROOT = runnerRoot;
HOME = runtimeDir;
RUNNER_ROOT = runtimeDir;
};

path = (with pkgs; [
Expand Down Expand Up @@ -241,7 +242,7 @@ in
# Home of persistent runner data, e.g., credentials
StateDirectory = [ systemdDir ];
StateDirectoryMode = "0700";
WorkingDirectory = runnerRoot;
WorkingDirectory = runtimeDir;

# By default, use a dynamically allocated user
DynamicUser = true;
Expand Down

0 comments on commit fcfa809

Please sign in to comment.