mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 10:10:06 +01:00
35 lines
816 B
Nix
35 lines
816 B
Nix
{
|
|
lib,
|
|
helpers,
|
|
}: let
|
|
inherit (lib) concatLines mapAttrsToList makeBinPath;
|
|
inherit (helpers) filterJobVariables stdenvMinimal;
|
|
in
|
|
{
|
|
key,
|
|
job,
|
|
nixConfig,
|
|
}: let
|
|
variablesWithStorePaths = filterJobVariables true job;
|
|
variableExports = concatLines (
|
|
mapAttrsToList (name: value: "export ${name}=\"${value}\"") variablesWithStorePaths
|
|
);
|
|
script = ''
|
|
export PATH="${makeBinPath (nixConfig.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;
|
|
};
|
|
}
|