mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
36 lines
823 B
Nix
36 lines
823 B
Nix
{
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
cilib = import ./. {inherit lib pkgs;};
|
|
inherit (cilib.helpers) filterJobVariables stdenvMinimal;
|
|
in {
|
|
mkJobDeps = {
|
|
key,
|
|
job,
|
|
}: let
|
|
variablesWithStorePaths = filterJobVariables true job;
|
|
variableExports = lib.concatLines (
|
|
lib.mapAttrsToList (name: value: "export ${name}=\"${value}\"") variablesWithStorePaths
|
|
);
|
|
script = ''
|
|
export PATH="${lib.makeBinPath (job.nix.deps or [])}:$PATH";
|
|
# variables containing nix derivations:
|
|
${variableExports}
|
|
'';
|
|
in
|
|
stdenvMinimal.mkDerivation {
|
|
name = "gitlab-ci-job-deps-${key}";
|
|
dontUnpack = true;
|
|
installPhase =
|
|
# sh
|
|
''
|
|
echo '${script}' > $out
|
|
chmod +x $out
|
|
'';
|
|
passthru = {
|
|
inherit script;
|
|
};
|
|
};
|
|
}
|