Installing depot-tools

HI!

How can i install depot_tools on nixOS? where is no option to enable it in options list. Also, there is no depot package in packages list.

i use 19.09 NixOS.

Unfortunately it does not exist, you can open a package request on Issues · NixOS/nixpkgs · GitHub. However, unless someone wants to take it upon themselves (like you :slight_smile:) , or has a vested in a package existing, it will probably never reach nixpkgs.

Looking quickly at their codebase, you could probably just create nix-shell with python and a few other utilities, and you would be fine following their install instructions. Most of the utilities are just bash or python scripts.

Thank you for answer! I’ll try to setup shell with python as you say. I’ll answer here if I get success

depot_tools is a tricky project. They don’t do any releases. Instead, developers are supposed to checkout the latest version from master and then run the collection of scripts that are inside it. Because of that, it makes all sorts of assumptions that make it hard to package. Which then makes it hard to package v8 and all the chrome-related technologies.

I wish they would consider the use-cases outside of Google but until then the easiest way is to use a nix-shell like @jonringer mentioned.

see also GitHub - input-output-hk/gclient2nix

or

git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools
cd depot_tools
nix-shell -p python3 python3.pkgs.google-auth-httplib2
python3 gclient.py

or

{ stdenv
, lib
, fetchgit
, writeShellScriptBin
, python3
}:

let
  # TODO buildPythonPackage
  depot_tools = fetchgit {
    url = "https://chromium.googlesource.com/chromium/tools/depot_tools.git";
    rev = "25cf78395cd77e11b13c1bd26124e0a586c19166";
    sha256 = "sha256-Qn0rqX2+wYpbyfwYzeaFsbsLvuGV6+S9GWrH3EqaHmU=";
  };
  gclient = writeShellScriptBin "gclient" ''
    ${python3.withPackages (py: with py; [ google-auth-httplib2 ])}/bin/python ${depot_tools}/gclient.py "$@"
  '';
in

stdenv.mkDerivation {
  nativeBuildInputs = [
    gclient
  ];
  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = "";
  buildPhase = ''
    gclient config https://github.com/xxxxx/yyyyyyyy
    gclient sync
    cp -r . $out
  '';
}
1 Like