geoclue: integrate ols/wigle as backend
the wigle API limits are *strict*. probably too strict to actually be useful
This commit is contained in:
parent
3cd97b522c
commit
b0e184b0f0
|
@ -53,6 +53,7 @@
|
||||||
./gdb.nix
|
./gdb.nix
|
||||||
./gdbus.nix
|
./gdbus.nix
|
||||||
./geary.nix
|
./geary.nix
|
||||||
|
./geoclue-demo-agent.nix
|
||||||
./geoclue2
|
./geoclue2
|
||||||
./git.nix
|
./git.nix
|
||||||
./gnome-clocks.nix
|
./gnome-clocks.nix
|
||||||
|
|
16
hosts/common/programs/geoclue-demo-agent.nix
Normal file
16
hosts/common/programs/geoclue-demo-agent.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
sane.programs.geoclue-demo-agent = {
|
||||||
|
packageUnwrapped = pkgs.linkFarm "geoclue-demo-agent" [{
|
||||||
|
# bring the demo agent into a `bin/` directory so it can be invokable via PATH
|
||||||
|
name = "bin/geoclue-demo-agent";
|
||||||
|
path = "${config.sane.programs.geoclue2.packageUnwrapped}/libexec/geoclue-2.0/demos/agent";
|
||||||
|
}];
|
||||||
|
|
||||||
|
services.geoclue-agent = {
|
||||||
|
description = "geoclue 'demo' agent";
|
||||||
|
command = "geoclue-demo-agent";
|
||||||
|
partOf = [ "graphical-session" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,11 +1,18 @@
|
||||||
# geoclue location services daemon.
|
# geoclue location services daemon.
|
||||||
#
|
#
|
||||||
# HOW TO TEST (hopefully):
|
# HOW TO TEST:
|
||||||
|
# - just invoke `where-am-i`: it should output the current latitude/longitude.
|
||||||
|
## more manual testing:
|
||||||
# - build `geoclue2-with-demo-agent`
|
# - build `geoclue2-with-demo-agent`
|
||||||
# - run the service: `systemctl start geoclue` or "${geoclue2-with-demo-agent}/libexec/geoclue"
|
# - run the service: `systemctl start geoclue` or "${geoclue2-with-demo-agent}/libexec/geoclue"
|
||||||
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent"
|
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent"
|
||||||
# - keep this running in the background
|
# - keep this running in the background
|
||||||
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/where-am-i"
|
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/where-am-i"
|
||||||
|
#
|
||||||
|
# DATA FLOW:
|
||||||
|
# - geoclue2 does http calls into local `ols`, which either hits the local disk or queries https://wigle.net.
|
||||||
|
# - geoclue users like gnome-maps somehow depend on an "agent",
|
||||||
|
# a user service which launches the geoclue system service on-demand (via dbus activation).
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.sane.programs.geoclue2;
|
cfg = config.sane.programs.geoclue2;
|
||||||
|
@ -16,7 +23,9 @@ in
|
||||||
# packageUnwrapped = pkgs.geoclue2.override { withDemoAgent = true; };
|
# packageUnwrapped = pkgs.geoclue2.override { withDemoAgent = true; };
|
||||||
packageUnwrapped = pkgs.geoclue2-with-demo-agent;
|
packageUnwrapped = pkgs.geoclue2-with-demo-agent;
|
||||||
suggestedPrograms = [
|
suggestedPrograms = [
|
||||||
"where-am-i"
|
"geoclue-demo-agent"
|
||||||
|
"ols" #< WiFi SSID -> lat/long lookups
|
||||||
|
"where-am-i" #< handy debugging/testing tool
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
# OLS: Offline Location Service: <https://codeberg.org/tpikonen/ols>
|
# OLS: Offline Location Service: <https://codeberg.org/tpikonen/ols>
|
||||||
{ ... }:
|
# fields {wifi SSID,cell tower} -> lat/long queries from geoclue
|
||||||
|
# satisfies queries via https://wigle.net, by learning about map tiles
|
||||||
|
# and caching those on-disk so that repeat queries may be serviced offline.
|
||||||
|
#
|
||||||
|
# it listens on localhost:8088, and one can validate its operation with a query like (substitute macAddresses for something real):
|
||||||
|
# curl -d '{"wifiAccessPoints":[{"macAddress":"01:23:45:67:89:ab","signalStrength":-78},{"macAddress":"cd:ef:01:23:45:56","signalStrength":-76}]}' http://127.0.0.1:8088/v1/geolocate
|
||||||
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
sane.programs.ols = {
|
sane.programs.ols = {
|
||||||
|
packageUnwrapped = pkgs.python3Packages.ols;
|
||||||
|
|
||||||
persist.byStore.private = [
|
persist.byStore.private = [
|
||||||
".local/share/ols"
|
".local/share/ols"
|
||||||
];
|
];
|
||||||
|
@ -10,7 +18,8 @@
|
||||||
|
|
||||||
services.ols = {
|
services.ols = {
|
||||||
description = "ols: Offline Location Service";
|
description = "ols: Offline Location Service";
|
||||||
command = "ols -d debug";
|
command = "ols";
|
||||||
|
partOf = [ "graphical-session" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user