Skip to content

Commit

Permalink
nixos/hydra: wrap systemPackages with hydra envvars
Browse files Browse the repository at this point in the history
Leave environment.variables untouched and wrap the utilities that are
added to environment.systemPackages. This avoids problems where shells
fail to source environment.variables.
  • Loading branch information
ehmry committed Apr 11, 2020
1 parent 0af01aa commit a030607
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions nixos/modules/services/continuous-integration/hydra/default.nix
Expand Up @@ -266,9 +266,24 @@ in
use-substitutes = ${if cfg.useSubstitutes then "1" else "0"}
'';

environment.systemPackages = [ cfg.package ];

environment.variables = hydraEnv;
environment.systemPackages = [
cfg.package
(pkgs.stdenv.mkDerivation {
name = "hydra-wrappers";
nativeBuildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
for b in ${cfg.package}/bin/*; do
makeWrapper "$b" "$out/bin/''${b##*/}" ${
toString (mapAttrsToList
(name: value: ''--set-default ${name} "${value}"'') hydraEnv)
}
done
'';
meta.priority = (cfg.package.meta.priority or 0) - 1;
# favor these wrappers over the originals
})
];

nix.extraOptions = ''
keep-outputs = true
Expand Down

0 comments on commit a030607

Please sign in to comment.