summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mo/mobsql/package.nix
blob: af5db21d171544a05b3696e36cdb54ffb7181cb4 (plain)
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
{
  lib,
  buildGoModule,
  fetchFromSourcehut,
  sqlite,
}:

buildGoModule (finalAttrs: {
  pname = "mobsql";
  version = "0.10.0";

  src = fetchFromSourcehut {
    owner = "~mil";
    repo = "mobsql";
    rev = "v${finalAttrs.version}";
    hash = "sha256-Q0TMSomLDDivfDD4bDeirEpzRUuoJkC0Ph3XIhJ/dYw=";
  };
  vendorHash = "sha256-YqduGY9c4zRQscjqze3ZOAB8EYj+0/6V7NceRwLe3DY=";

  buildInputs = [ sqlite ];

  buildPhase = ''
    runHook preBuild
    go build -o $GOPATH/bin/mobsql\
      -tags=sqlite_math_functions,libsqlite3 cli/*.go
    runHook postBuild
  '';

  checkPhase = ''
    runHook preCheck
    HOME=$TMPDIR go test -tags=sqlite_math_functions,libsqlite3 ./...
    runHook postCheck
  '';

  meta = {
    description = "GTFS to SQLite import utility";
    longDescription = ''
      Mobsql is a Go library and command-line application
      which facilitates loading one or multiple Mobility Database
      source GTFS feed archives into a SQLite database.
      Its internal SQLite schema mirrors GTFS's spec but adds a feed_id field
      to each table (thus allowing multiple feeds to be loaded
      to the database simultaneously).
    '';
    homepage = "https://git.sr.ht/~mil/mobsql";
    license = lib.licenses.gpl3Plus;
    maintainers = [ lib.maintainers.McSinyx ];
    mainProgram = "mobsql";
    platforms = lib.platforms.unix;
  };
})