gps-share: specify /dev path to GPS device

This commit is contained in:
Colin 2024-06-26 09:39:45 +00:00
parent d8ca5f91c3
commit 90f8d1e042
2 changed files with 23 additions and 3 deletions

View File

@ -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" ];
};
};

View File

@ -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
};