mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
chore: split everything up into their own files & add a bunch of tests
This commit is contained in:
parent
b309fb59db
commit
2f197d2c50
20 changed files with 704 additions and 310 deletions
36
lib/jobDeps.nix
Normal file
36
lib/jobDeps.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue