aboutsummaryrefslogtreecommitdiff
path: root/tools/mosdepth-plot.nix
blob: e6d2c7d1ac3f190a5f2a99d5ddd8d19c039f1583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ stdenv
, lib
, mosdepth
, python
, flags ? null}:

with lib;

{ inputs
, names ? []}:

stdenv.mkDerivation {
  name = "mosdepth-depth";
  buildInputs = [ python ];
  buildCommand = ''
    python ${mosdepth.src}/scripts/plot-dist.py ${concatMapStringsSep " " (i: "${i}/out.mosdepth.global.dist.txt") inputs}
    ${concatStringsSep "\n" (zipListsWith (i: n: "substituteInPlace dist.html --replace ${i}/out ${n}") inputs names)}
    substituteInPlace dist.html --replace "x: 0.1" "x: 0.9"
    substituteInPlace dist.html --replace "y: 0.1" "y: 0.9"
    mv dist.html $out
  '';
}