NixOS / hydra

Hydra, the Nix-based continuous build system
http://nixos.org/hydra
GNU General Public License v3.0
1.17k stars 300 forks source link

nix-prefetch-git determinism problems #637

Open sbourdeauducq opened 5 years ago

sbourdeauducq commented 5 years ago

I would like to see two changes to Hydra:

Background and rationale for those changes: we are using Hydra for continuous build, testing and distribution of a (complex) Python package, and I found all existing options to be deficient for different reasons:

If anyone else needs those modifications, here is the configuration.nix entry:

  services.hydra = {
    package = pkgs.hydra.overrideAttrs (oldAttrs: {
      src = pkgs.fetchFromGitHub {
        owner = "m-labs";
        repo = "hydra";
        rev = "b652be47f61a5241de43d80e4ff376e71fb09584";
        sha256 = "0gk4r8p2vc9vm9fxp3hckrhfzsqv39p2w6vlzkg2fly8b06pb2sl";
      };
    });
....
  }
MaxGabriel commented 5 years ago

@sbourdeauducq Can I ask how you're setting NIX_PREFETCH_GIT_LEAVE_DOT_GIT? The extraEnv setting hasn't worked for me and I resorted to copying across the postInstall and setting it there. Wondering if you had a better way.

postInstall = ''
              mkdir -p $out/nix-support
              for i in $out/bin/*; do
                  read -n 4 chars < $i
                  if [[ $chars =~ ELF ]]; then continue; fi
                  wrapProgram $i \
                      --prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \
                      --prefix PATH ':' $out/bin:$hydraPath \
                      --set HYDRA_RELEASE ${version} \
                      --set HYDRA_HOME $out/libexec/hydra \
                      --set NIX_RELEASE ${nix.name or "unknown"}
                      --set NIX_PREFETCH_GIT_LEAVE_DOT_GIT "1"
              done
            ''; # */
sbourdeauducq commented 5 years ago

@MaxGabriel This is all inside Hydra - in the Perl source code. I'm not sure if you can set those options externally with wrapProgram, I just apply patches to Hydra (e.g. https://github.com/m-labs/hydra/commit/b652be47f61a5241de43d80e4ff376e71fb09584).