diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index 8e59ad11..ae74cc8a 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -64,6 +64,7 @@ ./go2tv.nix ./gpodder.nix ./gpsd.nix + ./gps-share.nix ./grimshot.nix ./gst-device-monitor.nix ./gthumb.nix diff --git a/hosts/common/programs/geoclue2.nix b/hosts/common/programs/geoclue2.nix index 63c718d9..85cb67ab 100644 --- a/hosts/common/programs/geoclue2.nix +++ b/hosts/common/programs/geoclue2.nix @@ -32,6 +32,7 @@ in packageUnwrapped = pkgs.geoclue2-with-demo-agent; suggestedPrograms = [ "geoclue-demo-agent" + "gps-share" "ols" #< WiFi SSID -> lat/long lookups "satellite" #< graphical view into GPS fix data "where-am-i" #< handy debugging/testing tool diff --git a/hosts/common/programs/gps-share.nix b/hosts/common/programs/gps-share.nix new file mode 100644 index 00000000..80bdcc60 --- /dev/null +++ b/hosts/common/programs/gps-share.nix @@ -0,0 +1,22 @@ +# gps-share: +# takes a local GPS device (e.g. /dev/ttyUSB1) and makes it available over TCP/Avahi (multicast DNS). +# +# common usecases: +# 1. make positioning available to any device on a network, even if that device has no local GPS +# - e.g. my desktop can use my phone's GPS device, if on the same network. +# 2. allow multiple clients to share a GPS device. +# GPS devices are serial devices, and so only one process can consume the data at a time. +# gps-share can camp the serial device, and then allow *multiple* subscribers +# 3. provide a *read-only* API to clients like Geoclue. +# that is, expose the GPS device *output* to a client, but don't let the client write to the device (e.g. enable/disable the GPS). +# this is the primary function i derive from gps-share +{ ... }: +{ + sane.programs.gps-share = { + services.gps-share = { + description = "gps-share: make local GPS serial readings available over Avahi"; + command = "gps-share"; #< TODO: do i need to run it with any args? + dependencyOf = [ "geoclue-agent" ]; + }; + }; +}