diff --git a/hosts/common/programs/gps-share.nix b/hosts/common/programs/gps-share.nix index 80bdcc60..c1a90986 100644 --- a/hosts/common/programs/gps-share.nix +++ b/hosts/common/programs/gps-share.nix @@ -10,12 +10,29 @@ # 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 -{ ... }: +{ config, lib, ... }: +let + cfg = config.sane.programs.gps-share; +in { sane.programs.gps-share = { - services.gps-share = { + configOption = with lib; mkOption { + default = {}; + type = types.submodule { + options.device = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + path to GPS device to share. + ''; + example = "/dev/ttyUSB1"; + }; + }; + }; + + services.gps-share = lib.mkIf (cfg.config.device != null) { description = "gps-share: make local GPS serial readings available over Avahi"; - command = "gps-share"; #< TODO: do i need to run it with any args? + command = "gps-share ${cfg.config.device}"; dependencyOf = [ "geoclue-agent" ]; }; }; diff --git a/hosts/modules/hal/pine64.nix b/hosts/modules/hal/pine64.nix index 992bf3b8..ebe34460 100644 --- a/hosts/modules/hal/pine64.nix +++ b/hosts/modules/hal/pine64.nix @@ -283,6 +283,9 @@ in dd if=${pkgs.tow-boot-pinephone}/Tow-Boot.noenv.bin of=$out bs=1024 seek=8 conv=notrunc ''; + sane.programs.gps-share.config = { + device = "/dev/ttyUSB1"; + }; sane.programs.swaynotificationcenter.config = { backlight = "backlight"; # /sys/class/backlight/*backlight*/brightness };