1 { config, lib, pkgs, ... }:
7 uid = config.ids.uids.gpsd;
8 gid = config.ids.gids.gpsd;
9 cfg = config.services.gpsd;
24 description = lib.mdDoc ''
25 Whether to enable `gpsd', a GPS service daemon.
31 default = "/dev/ttyUSB0";
32 description = lib.mdDoc ''
33 A device may be a local serial device for GPS input, or a URL of the form:
34 `[{dgpsip|ntrip}://][user:passwd@]host[:port][/stream]`
35 in which case it specifies an input source for DGPS or ntrip data.
42 description = lib.mdDoc ''
43 Whether to enable the broken-device-safety, otherwise
44 known as read-only mode. Some popular bluetooth and USB
45 receivers lock up or become totally inaccessible when
46 probed or reconfigured. This switch prevents gpsd from
47 writing to a receiver. This means that gpsd cannot
48 configure the receiver for optimal performance, but it
49 also means that gpsd cannot break the receiver. A better
50 solution would be for Bluetooth to not be so fragile. A
51 platform independent method to identify
52 serial-over-Bluetooth devices would also be nice.
59 description = lib.mdDoc ''
60 don't wait for client connects to poll GPS
67 description = lib.mdDoc ''
68 The port where to listen for TCP connections.
72 debugLevel = mkOption {
75 description = lib.mdDoc ''
87 config = mkIf cfg.enable {
92 description = "gpsd daemon user";
96 users.groups.gpsd = { inherit gid; };
98 systemd.services.gpsd = {
99 description = "GPSD daemon";
100 wantedBy = [ "multi-user.target" ];
101 after = [ "network.target" ];
105 ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
106 -S "${toString cfg.port}" \
107 ${optionalString cfg.readonly "-b"} \
108 ${optionalString cfg.nowait "-n"} \