chore: slim down job-deps as much as possible

This commit is contained in:
technofab 2025-04-02 22:07:38 +02:00
parent 14530f8e9e
commit 8dc2e7d772

View file

@ -12,6 +12,15 @@
inherit (lib) isAttrs filterAttrs mapAttrs types mkOption toList; inherit (lib) isAttrs filterAttrs mapAttrs types mkOption toList;
cfg = config.ci.config; cfg = config.ci.config;
stdenvMinimal = pkgs.stdenvNoCC.override {
cc = null;
preHook = "";
allowedRequisites = null;
initialPath = [pkgs.coreutils pkgs.findutils];
shell = "/bin/sh";
extraNativeBuildInputs = [];
};
filterAttrsRec = pred: v: filterAttrsRec = pred: v:
if isAttrs v if isAttrs v
then filterAttrs pred (mapAttrs (path: filterAttrsRec pred) v) then filterAttrs pred (mapAttrs (path: filterAttrsRec pred) v)
@ -209,11 +218,22 @@
); );
in { in {
name = "gitlab-ci:pipeline:${pipeline_name}:job-deps:${key}"; name = "gitlab-ci:pipeline:${pipeline_name}:job-deps:${key}";
value = pkgs.writeShellScript "gitlab-ci-job-deps:${key}" '' value = stdenvMinimal.mkDerivation {
name = "gitlab-ci-job-deps-${key}";
dontUnpack = true;
installPhase = let
script = ''
export PATH="${lib.makeBinPath job.nix.deps}:$PATH"; export PATH="${lib.makeBinPath job.nix.deps}:$PATH";
# variables containing nix derivations: # variables containing nix derivations:
${variableExports} ${variableExports}
''; '';
in
# sh
''
echo '${script}' > $out
chmod +x $out
'';
};
}) })
jobs; jobs;
# allows the user to directly run the script # allows the user to directly run the script