diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2018-05-12 11:17:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-12 11:17:15 +0200 |
| commit | 192e2b40e059efdffcfa4b7122b0547874f3278b (patch) | |
| tree | 859fc346ac1ed577f98057fc6f175fc7fbf9b209 /modules | |
| parent | 6dbc6d43b5db21b01e2db7d59cdc3eb4ad83cd64 (diff) | |
| parent | 6d6d11fdad377d82aaf1d61173dd9fa6764da07a (diff) | |
Merge pull request #75 from rvl/buildkite-agent-fixes
buildkite-agent fixes
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/services/buildkite-agent.nix | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/modules/services/buildkite-agent.nix b/modules/services/buildkite-agent.nix index 96c2f3b..936446d 100644 --- a/modules/services/buildkite-agent.nix +++ b/modules/services/buildkite-agent.nix @@ -16,18 +16,16 @@ let mkHookOptions = hooks: listToAttrs (map mkHookOption hooks); hooksDir = let - mkHookEntry = name: value: '' - cat > $out/${name} <<EOF - #! ${pkgs.stdenv.shell} - set -e - ${value} - EOF - chmod 755 $out/${name} - ''; - in pkgs.runCommand "buildkite-agent-hooks" {} '' - mkdir $out - ${concatStringsSep "\n" (mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks))} - ''; + mkHookEntry = name: value: { + inherit name; + path = pkgs.writeScript "buildkite-agent-hook-${name}" '' + #! ${pkgs.stdenv.shell} + set -e + ${value} + ''; + }; + in pkgs.linkFarm "buildkite-agent-hooks" + (mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks)); in @@ -221,11 +219,20 @@ in ''; serviceConfig = { - KeepAlive = true; - RunAtLoad = true; ProcessType = "Interactive"; ThrottleInterval = 30; + # The combination of KeepAlive.NetworkState and WatchPaths + # will ensure that buildkite-agent is started on boot, but + # after networking is available (so the hostname is + # correct). + RunAtLoad = true; + KeepAlive.NetworkState = true; + WatchPaths = [ + "/etc/resolv.conf" + "/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist" + ]; + GroupName = "buildkite-agent"; UserName = "buildkite-agent"; WorkingDirectory = config.users.users.buildkite-agent.home; |
