   		@result = read_gcov_file($gcov_file);
 ***************
 *** 949,954 ****
---- 955,974 ----
+--- 955,979 ----
   }
   
   

  
  			read(INPUT, $packed_word, 4);
  			$lineno = unpack_int32($packed_word, $endianness);
--- 1498,1504 ----
  			$function_name =~ s/\W/_/g;
  			(undef, $filename) =
  				read_gcno_string(*INPUT, $endianness);

+ {
+         my ($base_dir, $source) = @_;
+         my $dir = $base_dir;
+ 
+         # Hack to make absolute paths work on Nixpkgs coverage
+         # reports.  The source is in /nix/store/<bla>/.build/<bla>.
+         $source = $1 if $source =~ /^\/.*\/\.build\/(.*)$/;
+         
+         while (!-e "$dir/$source") {
+                 $dir = $dir . "/..";
+                 if (length $dir > 1000) {
