nixos/gpsd: add multiple-device support for gpsd
This commit is contained in:
parent
c707583645
commit
3ecc7b1484
@ -396,6 +396,9 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
- The option `services.prometheus.exporters.pihole.interval` does not exist anymore and has been removed.
|
||||
|
||||
- The option `services.gpsd.device` has been replaced with
|
||||
`services.gpsd.devices`, which supports multiple devices.
|
||||
|
||||
- `k3s` can now be configured with an EnvironmentFile for its systemd service, allowing secrets to be provided without ending up in the Nix Store.
|
||||
|
||||
- `boot.initrd.luks.device.<name>` has a new `tryEmptyPassphrase` option, this is useful for OEM's who need to install an encrypted disk with a future settable passphrase
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, utils, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@ -8,12 +8,15 @@ let
|
||||
gid = config.ids.gids.gpsd;
|
||||
cfg = config.services.gpsd;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
|
||||
###### interface
|
||||
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule [ "services" "gpsd" "device" ]
|
||||
"Use `services.gpsd.devices` instead.")
|
||||
];
|
||||
|
||||
options = {
|
||||
|
||||
services.gpsd = {
|
||||
@ -26,13 +29,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
device = mkOption {
|
||||
type = types.str;
|
||||
default = "/dev/ttyUSB0";
|
||||
devices = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "/dev/ttyUSB0" ];
|
||||
description = lib.mdDoc ''
|
||||
A device may be a local serial device for GPS input, or a URL of the form:
|
||||
`[{dgpsip|ntrip}://][user:passwd@]host[:port][/stream]`
|
||||
in which case it specifies an input source for DGPS or ntrip data.
|
||||
List of devices that `gpsd` should subscribe to.
|
||||
|
||||
A device may be a local serial device for GPS input, or a
|
||||
URL of the form:
|
||||
`[{dgpsip|ntrip}://][user:passwd@]host[:port][/stream]` in
|
||||
which case it specifies an input source for DGPS or ntrip
|
||||
data.
|
||||
'';
|
||||
};
|
||||
|
||||
@ -89,17 +96,16 @@ in
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users.gpsd =
|
||||
{ inherit uid;
|
||||
group = "gpsd";
|
||||
description = "gpsd daemon user";
|
||||
home = "/var/empty";
|
||||
};
|
||||
users.users.gpsd = {
|
||||
inherit uid;
|
||||
group = "gpsd";
|
||||
description = "gpsd daemon user";
|
||||
home = "/var/empty";
|
||||
};
|
||||
|
||||
users.groups.gpsd = { inherit gid; };
|
||||
|
||||
@ -109,13 +115,15 @@ in
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
ExecStart = ''
|
||||
ExecStart = let
|
||||
devices = utils.escapeSystemdExecArgs cfg.devices;
|
||||
in ''
|
||||
${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
|
||||
-S "${toString cfg.port}" \
|
||||
${optionalString cfg.readonly "-b"} \
|
||||
${optionalString cfg.nowait "-n"} \
|
||||
${optionalString cfg.listenany "-G"} \
|
||||
"${cfg.device}"
|
||||
${devices}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user