summary refs log tree commit diff
path: root/pkgs/applications/misc/visidata/default.nix
blob: 71907fc80b18122d23c4e4d91ae46b7d612bc371 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{ stdenv
, lib
, buildPythonApplication
, fetchFromGitHub
, python-dateutil
, pandas
, requests
, lxml
, openpyxl
, xlrd
, h5py
, psycopg2
, pyshp
, fonttools
, pyyaml
, pdfminer
, vobject
, tabulate
, wcwidth
, zstandard
, setuptools
, git
, withPcap ? true, dpkt, dnslib
}:
buildPythonApplication rec {
  pname = "visidata";
  version = "2.5";

  src = fetchFromGitHub {
    owner = "saulpw";
    repo = "visidata";
    rev = "v${version}";
    sha256 = "1iijggdgj36v7d2zm45c00nrbzxaaah2azflpca0f6fjaaxh3lr2";
  };

  propagatedBuildInputs = [
    # from visidata/requirements.txt
    # packages not (yet) present in nixpkgs are commented
    python-dateutil
    pandas
    requests
    lxml
    openpyxl
    xlrd
    h5py
    psycopg2
    pyshp
    #mapbox-vector-tile
    #pypng
    fonttools
    #sas7bdat
    #xport
    #savReaderWriter
    pyyaml
    #namestand
    #datapackage
    pdfminer
    #tabula
    vobject
    tabulate
    wcwidth
    zstandard
    setuptools
  ] ++ lib.optionals withPcap [ dpkt dnslib ];

  checkInputs = [
    git
  ];

  # check phase uses the output bin, which is not possible when cross-compiling
  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;

  checkPhase = ''
    # disable some tests which require access to the network
    rm tests/load-http.vd            # http
    rm tests/graph-cursor-nosave.vd  # http
    rm tests/messenger-nosave.vd     # dns

    # tests use git to compare outputs to references
    git init -b "test-reference"
    git config user.name "nobody"; git config user.email "no@where"
    git add .; git commit -m "test reference"

    substituteInPlace dev/test.sh --replace "bin/vd" "$out/bin/vd"
    bash dev/test.sh
  '';

  meta = {
    inherit version;
    description = "Interactive terminal multitool for tabular data";
    license = lib.licenses.gpl3;
    maintainers = [ lib.maintainers.raskin ];
    homepage = "http://visidata.org/";
    changelog = "https://github.com/saulpw/visidata/blob/v${version}/CHANGELOG.md";
  };
}