mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
feat: initial v3 rewrite
This commit is contained in:
commit
0952ab4145
32 changed files with 1457 additions and 0 deletions
35
lib/impl/jobDeps.nix
Normal file
35
lib/impl/jobDeps.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue