nix-files/hosts/common/programs/calls.nix

71 lines
2.7 KiB
Nix
Raw Normal View History

2023-09-17 05:00:15 +00:00
# GNOME calls
# - <https://gitlab.gnome.org/GNOME/calls>
# - both a dialer and a call handler.
2024-05-18 20:55:09 +00:00
# - uses callaudiod dbus service.
2023-09-17 05:00:15 +00:00
#
# initial JMP.chat configuration:
# - message @cheogram.com "reset sip account" (this is not destructive, despite the name)
# - the bot will reply with auto-generated username/password plus a SIP server endpoint.
# just copy those into gnome-calls' GUI configurator
2024-05-17 00:36:56 +00:00
# - now gnome-calls can do outbound calls. inbound calls can be routed by messaging the bot: "configure calls"
2024-05-18 06:32:23 +00:00
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.calls;
in
2023-09-17 05:00:15 +00:00
{
sane.programs.calls = {
2023-09-21 19:44:11 +00:00
configOption = with lib; mkOption {
default = {};
type = types.submodule {
options.autostart = mkOption {
type = types.bool;
2024-05-17 00:41:32 +00:00
default = true;
2023-09-21 19:44:11 +00:00
};
};
};
2024-05-18 06:32:23 +00:00
packageUnwrapped = pkgs.calls.overrideAttrs (upstream: {
patches = (upstream.patches or []) ++ [
(pkgs.fetchpatch {
# usability improvement... if the UI is visible, then i can receive calls. otherwise, i can't!
url = "https://git.uninsane.org/colin/gnome-calls/commit/a19166d85927e59662fae189a780eed18bf876ce.patch";
name = "exit on close (i.e. never daemonize)";
hash = "sha256-NoVQV2TlkCcsBt0uwSyK82hBKySUW4pADrJVfLFvWgU=";
})
];
});
2024-05-18 06:52:53 +00:00
sandbox.method = "bwrap";
sandbox.net = "clearnet";
sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ]; # necessary for secrets, at the minimum
sandbox.whitelistWayland = true;
persist.byStore.private = [
# ".cache/folks" # contact avatars?
# ".config/calls"
2023-09-17 05:00:15 +00:00
".local/share/calls" # call "records"
# .local/share/folks # contacts?
];
2024-05-17 00:36:56 +00:00
# this is only the username/endpoint: the actual password appears to be stored in gnome-keyring
secrets.".config/calls/sip-account.cfg" = ../../../secrets/common/gnome_calls_sip-account.cfg.bin;
2023-09-17 05:00:15 +00:00
suggestedPrograms = [
"callaudiod" # runtime dependency (optional, but probably needed for mic muting?)
2023-09-17 05:00:15 +00:00
"feedbackd" # needs `phone-incoming-call`, in particular
2024-05-17 00:36:56 +00:00
"gnome-keyring" # to remember the password
2023-09-17 05:00:15 +00:00
];
services.gnome-calls = {
description = "gnome-calls daemon to monitor incoming SIP calls";
partOf = lib.mkIf cfg.config.autostart [ "graphical-session" ];
# add --verbose for more debugging
2024-05-18 06:32:23 +00:00
# add --daemon to avoid showing UI on launch.
# note that no matter the flags, it returns to being a daemon whenever the UI is manually closed,
# revealed when launched.
# default latency is 10ms, which is too low and i get underruns on moby.
# 50ms is copied from dino, not at all tuned.
command = "env G_MESSAGES_DEBUG=all PULSE_LATENCY_MSEC=50 gnome-calls";
};
2023-09-17 05:00:15 +00:00
};
}