programs: ship geoclue2 as an actual program

moby probably needs its gps.nix file removed. also this is incomplete due to Mozilla terminating their location services API
This commit is contained in:
Colin 2024-06-20 08:40:36 +00:00
parent 0db86d8c86
commit d0d623da15
7 changed files with 110 additions and 10 deletions

View File

@ -53,6 +53,7 @@
./gdb.nix
./gdbus.nix
./geary.nix
./geoclue2
./git.nix
./gnome-clocks.nix
./gnome-feeds.nix
@ -147,6 +148,7 @@
./vlc.nix
./waybar
./waylock.nix
./where-am-i.nix
./wike.nix
./wine.nix
./wireplumber.nix

View File

@ -0,0 +1,50 @@
# geoclue location services daemon.
#
# HOW TO TEST (hopefully):
# - build `geoclue2-with-demo-agent`
# - run the service: `systemctl start geoclue` or "${geoclue2-with-demo-agent}/libexec/geoclue"
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent"
# - keep this running in the background
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/where-am-i"
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.geoclue2;
in
{
sane.programs.geoclue2 = {
# packageUnwrapped = pkgs.rmDbusServices pkgs.geoclue2;
# packageUnwrapped = pkgs.geoclue2.override { withDemoAgent = true; };
packageUnwrapped = pkgs.geoclue2-with-demo-agent;
suggestedPrograms = [
"where-am-i"
];
};
sane.programs.geoclue2.enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true;
systemd.packages = lib.mkIf cfg.enableFor.system [ cfg.package ];
services.dbus.packages = lib.mkIf cfg.enableFor.system [ cfg.package ];
# TODO: i should be able to run this as an ordinary user
users = lib.mkIf cfg.enableFor.system {
users.geoclue = {
isSystemUser = true;
home = "/var/lib/geoclue";
group = "geoclue";
description = "Geoinformation service";
};
groups.geoclue = {};
};
systemd.services.geoclue = lib.mkIf cfg.enableFor.system {
restartTriggers = [
config.environment.etc."geoclue/geoclue.conf".source
];
serviceConfig.StateDirectory = "geoclue";
};
environment.etc."geoclue/geoclue.conf" = lib.mkIf cfg.enableFor.system {
source = ./geoclue.conf;
};
}

View File

@ -0,0 +1,43 @@
[3g]
enable=true
[agent]
whitelist=geoclue-demo-agent;gnome-shell;io.elementary.desktop.agent-geoclue2
[cdma]
enable=true
[epiphany]
allowed=true
system=false
users=
[firefox]
allowed=true
system=false
users=
[geoclue-where-am-i]
allowed=true
system=false
users=1000
[modem-gps]
enable=true
[network-nmea]
enable=true
# i think this one is wrong, and is supposed to be `geoclue-where-am-i`
[where-am-i]
allowed=true
system=false
users=1000
[wifi]
enable=true
submission-nick=geoclue
submission-url=https://location.services.mozilla.com/v1/submit?key=geoclue
submit-data=false
# url=https://location.services.mozilla.com/v1/geolocate?key=geoclue

View File

@ -2,6 +2,10 @@
{
sane.programs."gnome.gnome-maps" = {
packageUnwrapped = pkgs.rmDbusServices pkgs.gnome.gnome-maps;
suggestedPrograms = [
"geoclue2"
];
sandbox.method = "bwrap";
sandbox.whitelistDri = true; # for perf
sandbox.whitelistDbus = [

View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
sane.programs.where-am-i = {
# packageUnwrapped = pkgs.linkIntoOwnPackage config.sane.programs.geoclue2.packageUnwrapped "libexec/geoclue-2.0/demos/where-am-i";
packageUnwrapped = pkgs.linkFarm "where-am-i" [{
# bring the `where-am-i` tool into a `bin/` directory so it can be invokable via PATH
name = "bin/where-am-i";
path = "${config.sane.programs.geoclue2.packageUnwrapped}/libexec/geoclue-2.0/demos/where-am-i";
}];
};
}

View File

@ -1,9 +0,0 @@
{ linkFarm
, geoclue2
}:
linkFarm "where-am-i" [{
# bring the `where-am-i` tool into a `bin/` directory so it can be invokable via PATH
name = "bin/where-am-i";
path = "${geoclue2}/libexec/geoclue-2.0/demos/where-am-i";
}]

View File

@ -113,7 +113,6 @@ let
runCommandLocalOverridable
;
unftp = callPackage ./additional/unftp { };
where-am-i = callPackage ./additional/where-am-i { };
zecwallet-light-cli = callPackage ./additional/zecwallet-light-cli { };
# packages i haven't used for a while, may or may not still work