fix: use path= (ExecSearchPath) to add nix to hive-ci runner PATH

This commit is contained in:
atlas 2026-06-03 21:39:16 +02:00 committed by mara
commit 4d1ce6f313

View file

@ -267,27 +267,21 @@ in
systemd.services."gitea-runner-hive".after = [ "hive-ci-register.service" ];
systemd.services."gitea-runner-hive".wants = [ "hive-ci-register.service" ];
# git is required by the runner's checkout step.
# git is already in the gitea-actions-runner service PATH (the
# nixpkgs module builds it from the package's runtime deps).
# nix is required for `nix flake check` / `nix build` workflow
# steps — it's not in the runner's job PATH by default since
# systemd services don't inherit the NixOS login-shell PATH.
# steps — it's not included by the upstream module.
# Use the `path` service attribute (generates ExecSearchPath=)
# to prepend nix's bin dir to PATH without touching the
# environment.PATH the nixpkgs module sets — overriding that
# would lose git, curl, nodejs, and other runner deps.
# curl/jq in the register script use absolute store paths.
environment.systemPackages = [
pkgs.git
pkgs.nix
];
# Expose /run/current-system/sw/bin (where system packages
# land) and the nix profile bin dir to the runner's job
# execution environment. The gitea-actions-runner host scheme
# spawns job processes with the service's environment; without
# this PATH override, `nix` and `git` aren't visible to steps.
# mkForce is required: the nixpkgs gitea-actions-runner module
# also sets PATH in the service environment, so without an
# explicit priority the evaluator raises a conflicting
# definition error.
systemd.services."gitea-runner-hive".environment.PATH =
lib.mkForce "/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/bin:/bin";
systemd.services."gitea-runner-hive".path = [ pkgs.nix ];
};
};
};