summary refs log tree commit diff
path: root/pkgs/tools/misc/sqlite3-to-mysql/default.nix
blob: 9063fd1966b4c8c36a349ab80fffd0d70ee49914 (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
{ lib
, fetchFromGitHub
, python3
, nixosTests
, testers
, sqlite3-to-mysql
, fetchPypi
}:

let
  py = python3.override {
    packageOverrides = self: super: {
      # sqlite3-to-mysql is incompatible with versions > 1.4.44 of sqlalchemy
      sqlalchemy = super.sqlalchemy.overridePythonAttrs rec {
        version = "1.4.44";
        format = "setuptools";
        src = fetchPypi {
          pname = "SQLAlchemy";
          inherit version;
          hash = "sha256-LdpflnGa6Js+wPG3lpjYbrmuyx1U6ZCrs/3ZLAS0apA=";
        };
        disabledTestPaths = [
           "test/aaa_profiling"
           "test/ext/mypy"
        ];
      };
    };
    self = py;
  };

in
with py.pkgs; buildPythonApplication rec {
  pname = "sqlite3-to-mysql";
  version = "1.4.19";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "techouse";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-gtXwDLHl5f1sXLm+b8l08bY/XJkN+zVtd7m45K0CAYY=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    click
    mysql-connector
    pytimeparse
    pymysql
    pymysqlsa
    six
    simplejson
    sqlalchemy
    sqlalchemy-utils
    tqdm
    tabulate
    unidecode
    packaging
  ];

  # tests require a mysql server instance
  doCheck = false;

  # run package tests as a separate nixos test
  passthru.tests = {
    nixosTest = nixosTests.sqlite3-to-mysql;
    version = testers.testVersion {
      package = sqlite3-to-mysql;
      command = "sqlite3mysql --version";
    };
  };

  meta = with lib; {
    description = "A simple Python tool to transfer data from SQLite 3 to MySQL";
    homepage = "https://github.com/techouse/sqlite3-to-mysql";
    license = licenses.mit;
    maintainers = with maintainers; [ gador ];
  };
}