mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-11 17:50:08 +01:00
the goal was to remove "variables" when it's empty, but this resulted in the original value being used if all of the variables contained store paths. This is not supposed to happen and thus fixed with this.
31 lines
845 B
Nix
31 lines
845 B
Nix
{
|
|
lib,
|
|
helpers,
|
|
}: let
|
|
inherit (lib) toList optionalAttrs optional;
|
|
inherit (helpers) prependToBeforeScript appendToAfterScript filterJobVariables;
|
|
in
|
|
{
|
|
key,
|
|
job,
|
|
pipelineName,
|
|
nixConfig,
|
|
}:
|
|
job
|
|
// (optionalAttrs nixConfig.enable (
|
|
(prependToBeforeScript ["source setup_nix_ci \"gitlab-ci:pipeline:${pipelineName}:job-deps:${key}\""] job)
|
|
// (appendToAfterScript ["finalize_nix_ci"] job)
|
|
))
|
|
// optionalAttrs nixConfig.enable {
|
|
variables =
|
|
(filterJobVariables false job)
|
|
// optionalAttrs nixConfig.enableRunnerCache {
|
|
NIX_CI_CACHE_STRATEGY = "runner";
|
|
};
|
|
cache =
|
|
(toList (job.cache or []))
|
|
++ (optional nixConfig.enableRunnerCache {
|
|
key = nixConfig.runnerCacheKey;
|
|
paths = [".nix-cache/"];
|
|
});
|
|
}
|