1{
2 lib,
3 buildGoModule,
4 fetchFromSourcehut,
5 sqlite,
6}:
7
8buildGoModule rec {
9 pname = "mobsql";
10 version = "0.9.0";
11
12 src = fetchFromSourcehut {
13 owner = "~mil";
14 repo = "mobsql";
15 rev = "v${version}";
16 hash = "sha256-7zrM2vmaikyClNgHHO8OXmATNpJtH85/CDv/86vwzZU=";
17 };
18 vendorHash = "sha256-YqduGY9c4zRQscjqze3ZOAB8EYj+0/6V7NceRwLe3DY=";
19
20 buildInputs = [ sqlite ];
21
22 buildPhase = ''
23 runHook preBuild
24 go build -o $GOPATH/bin/mobsql\
25 -tags=sqlite_math_functions,libsqlite3 cli/*.go
26 runHook postBuild
27 '';
28
29 checkPhase = ''
30 runHook preCheck
31 HOME=$TMPDIR go test -tags=sqlite_math_functions,libsqlite3 ./...
32 runHook postCheck
33 '';
34
35 meta = with lib; {
36 description = "GTFS to SQLite import utility";
37 longDescription = ''
38 Mobsql is a Go library and command-line application
39 which facilitates loading one or multiple Mobility Database
40 source GTFS feed archives into a SQLite database.
41 Its internal SQLite schema mirrors GTFS's spec but adds a feed_id field
42 to each table (thus allowing multiple feeds to be loaded
43 to the database simulatenously).
44 '';
45 homepage = "https://git.sr.ht/~mil/mobsql";
46 license = licenses.gpl3Plus;
47 maintainers = [ maintainers.McSinyx ];
48 mainProgram = "mobsql";
49 platforms = platforms.unix;
50 };
51}