Skip to content
Snippets Groups Projects
Select Git revision
  • 2ef931921a9f45b94f31af5d59bdee3bd7d3300e
  • master default protected
  • 1.31
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
  • 4.32.0
  • 4.31.0
  • 4.30.1
  • 4.30.0
  • 4.29.1
  • 4.29.0
  • 4.28.0
  • 4.27.0
  • 4.26.0
  • 4.25.5
  • 4.25.4
  • 4.25.3
  • 4.25.2
  • 4.25.1
23 results

tabs.mjs

Blame
  • update-hashes.nix 1.54 KiB
    {
      pkgs,
      buildRoot,
      projectDefinition,
      workingDirectory,
      ...
    }: let
      serviceSourcePath = "${buildRoot}/";
      common = import ./common.nix {inherit pkgs;};
    in ''
      #!${pkgs.bash}/bin/bash
    
      ${common}
      
      defaultHash="${pkgs.lib.fakeHash}"
    
      echo_step "Reset vendorHash to default value: $defaultHash"
      ${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*null|vendorHash = \"$defaultHash\"|g" ${workingDirectory}/project.nix
      ${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*\"[^\"]\"|vendorHash = \"$defaultHash\"|g" ${workingDirectory}/project.nix
      
      RESULT=$(${pkgs.nix}/bin/nix build .#goPkg 2>&1)
      if [[ $? -ne 0 ]]; then
    
        ## check if  RESULT contain vendorHash = null; then set to null and rebuild
        if [[ "$RESULT" == *"vendorHash = null"* ]]; then
            ${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*\".*\"|vendorHash = null|g" ${workingDirectory}/project.nix
            RESULT=$(${pkgs.nix}/bin/nix build .#goPkg 2>&1)
    
            if [[ $? -ne 0 ]]; then
                echo_fail "Could not get the hash"
                exit 1
            fi
    
            echo_ok "No dependencies found and vendorHash is set to null."
            exit 0
    
        fi
    
      fi
    
      HASH=$(echo "$RESULT" | grep 'got:'  | awk '{print $2}')
      if [[ -z "$HASH" ]]; then
        echo_fail "Could not get the hash"
        ${pkgs.gnused}/bin/sed -i 's|vendorHash\s*=\s*".*"|vendorHash = null|g' ${workingDirectory}/project.nix
        exit 1
      fi
    
      ${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*\".*\"|vendorHash = \"''${HASH}\"|g" ${workingDirectory}/project.nix
      echo_ok "Hash updated, new hash is ''${HASH}'"
    
    
    ''