Fetchgit and keeping/getting tags

Hi all,

I am in a difficult situation where cmake use information from git.

Is there a way to from fetchgit also the tags of a repository?

Many thanks!

I recommend to patch away the code that fetches that information and substitute it in with Nix.

you can also look at pkgs/build-support/fetchgit/default.nix and see it accepts a leaveDotGit boolean

You’ll probably need some way to explicitly instruct it to fetch tags too though, otherwise it will likely just clone the single branch it needs.

Indeed it was my final solution, but it seems ugly!

I use it, but it didn’t quite work, maybe is me doing something wrong…

Eventually I will report back with an example!

I have some code running for instance

  src = fetchgit rec {

    url = https://github.com/vhakulinen/gnvim;
    rev = "4b248cda4a6858544c6dbe9a4ad79796a7008247";
    sha256 = "1f5vfi5nxn9zscad2cgjdm5sdgi0jrnmhswyhr05h55y6iqcnnb4";

    # gnvim detects its version from tags
    leaveDotGit = true;
    postFetch = ''
      set -x
      cd $out
      echo $PWD
      git fetch -vv --tags ${url}
      set +x

Many many thanks!

I will try it ASAP!

I really appreciate it!