anchor.diff:    haveLocalDB = cfg.dbi == localDB;
   
     inherit (config.system) stateVersion;
  +
  +  hydra-package =
  +  let
  +    makeWrapperArgs = concatStringsSep " " (mapAttrsToList (key: value: "--set \"${key}\" \"${value}\"") hydraEnv);
  +  in pkgs.buildEnv rec {
  +    name = "hydra-env";
  +    buildInputs = [ pkgs.makeWrapper ];
  +    paths = [ cfg.package ];
  +
  +    postBuild = ''
  +      if [ -L "$out/bin" ]; then
  +          unlink "$out/bin"
  +      fi
  +      mkdir -p "$out/bin"
  +
  +      for path in ${concatStringsSep " " paths}; do
  +        if [ -d "$path/bin" ]; then
  +          cd "$path/bin"
  +          for prg in *; do
  +            if [ -f "$prg" ]; then
  +              rm -f "$out/bin/$prg"
  +              if [ -x "$prg" ]; then
  +                makeWrapper "$path/bin/$prg" "$out/bin/$prg" ${makeWrapperArgs}
  +              fi
  +            fi
  +          done
  +        fi
  +      done
  +   '';
  +  };
   
   in
   
  
positive.code:       { wantedBy = [ "multi-user.target" ];
          requires = [ "hydra-init.service" ];
          after = [ "hydra-init.service" "network.target" ];
          path = with pkgs; [ cfg.package nettools jq ];
          restartTriggers = [ hydraConf ];
          environment = env;
          serviceConfig =
            { ExecStart = "@${cfg.package}/bin/hydra-evaluator hydra-evaluator";
              User = "hydra";
              Restart = "always";
              WorkingDirectory = baseDir;
  
negative.code:           chown hydra.hydra ${cfg.gcRootsDir}
            chmod 2775 ${cfg.gcRootsDir}
          '';
          serviceConfig.ExecStart = "${hydra-package}/bin/hydra-init";
          serviceConfig.PermissionsStartOnly = true;
          serviceConfig.User = "hydra";
          serviceConfig.Type = "oneshot";
  