programs: replace systemd-specific 'environment' option with generic 'env'

note, these services no longer work with systemd, because systemd expects absolute paths
This commit is contained in:
Colin 2024-03-18 02:21:02 +00:00
parent d199e9df99
commit 291e704477
11 changed files with 69 additions and 61 deletions

View File

@ -47,12 +47,11 @@ in
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
# add --verbose for more debugging
ExecStart = "${cfg.package}/bin/gnome-calls --daemon";
ExecStart = "env G_MESSAGES_DEBUG=all ${cfg.package}/bin/gnome-calls --daemon";
Type = "simple";
Restart = "always";
RestartSec = "10s";
};
environment.G_MESSAGES_DEBUG = "all";
};
};
programs.calls = lib.mkIf cfg.enabled {

View File

@ -73,21 +73,19 @@ in
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/dino";
# audio buffering; see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>
# dino defaults to 10ms mic buffer, which causes underruns, which Dino handles *very* poorly
# as in, the other end of the call will just not receive sound from us for a couple seconds.
# pipewire uses power-of-two buffering for the mic itself. that would put us at 21.33 ms, but this env var supports only whole numbers (21ms ends up not power-of-two).
# also, Dino's likely still doing things in 10ms batches internally anyway.
#
# note that debug logging during calls produces so much journal spam that it pegs the CPU and causes dropped audio
# env G_MESSAGES_DEBUG = "all";
ExecStart = "env PULSE_LATENCY_MSEC=20 ${cfg.package}/bin/dino";
Type = "simple";
Restart = "always";
RestartSec = "20s";
};
# audio buffering; see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>
# dino defaults to 10ms mic buffer, which causes underruns, which Dino handles *very* poorly
# as in, the other end of the call will just not receive sound from us for a couple seconds.
# pipewire uses power-of-two buffering for the mic itself. that would put us at 21.33 ms, but this env var supports only whole numbers (21ms ends up not power-of-two).
# also, Dino's likely still doing things in 10ms batches internally anyway.
environment.PULSE_LATENCY_MSEC = "20";
# note that debug logging during calls produces so much journal spam that it pegs the CPU and causes dropped audio
# environment.G_MESSAGES_DEBUG = "all";
};
};
}

View File

@ -98,16 +98,18 @@ in
description = "feedbackd audio/vibration/led controller";
wantedBy = [ "default.target" ]; #< should technically be `sound.target`, but that doesn't seem to get auto-started?
serviceConfig = {
ExecStart = "${cfg.package}/libexec/feedbackd";
ExecStart = lib.escapeShellArgs ([
"env"
"G_MESSAGES_DEBUG=all"
] ++ lib.optionals cfg.config.proxied [
"FEEDBACK_THEME=$HOME/.config/feedbackd/themes/proxied.json"
] ++ [
"${cfg.package}/libexec/feedbackd"
]);
Type = "simple";
Restart = "on-failure";
RestartSec = "10s";
};
environment = {
G_MESSAGES_DEBUG = "all";
} // (lib.optionalAttrs cfg.config.proxied {
FEEDBACK_THEME = "/home/colin/.config/feedbackd/themes/proxied.json";
});
};
};

View File

@ -73,12 +73,12 @@ in
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
# env "G_MESSAGES_DEBUG=all"
ExecStart = "${cfg.package}/bin/fractal";
Type = "simple";
Restart = "always";
RestartSec = "20s";
};
# environment.G_MESSAGES_DEBUG = "all";
};
};
}

View File

@ -33,6 +33,8 @@ in
after = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
# env PIPEWIRE_LOG_SYSTEMD=false"
# env PIPEWIRE_DEBUG"*:3,mod.raop*:5,pw.rtsp-client*:5"
ExecStart = "${cfg.package}/bin/pipewire";
ExecStartPost = pkgs.writeShellScript "pipewire-wait-started" ''
waitFor() {
@ -48,9 +50,6 @@ in
Restart = "always";
RestartSec = "5s";
};
# environment.PIPEWIRE_LOG_SYSTEMD = "false";
# environment.PIPEWIRE_DEBUG = "*:3,mod.raop*:5,pw.rtsp-client*:5";
};
services.pipewire-pulse = {
description = "pipewire-pulse: Pipewire compatibility layer for PulseAudio clients";

View File

@ -51,13 +51,12 @@ in
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/signal-desktop";
# for some reason the --ozone-platform-hint=auto flag fails when signal-desktop is launched from a service
ExecStart = "env NIXOS_OZONE_WL=1 ${cfg.package}/bin/signal-desktop";
Type = "simple";
Restart = "always";
RestartSec = "20s";
};
# for some reason the --ozone-platform-hint=auto flag fails when signal-desktop is launched from a service
environment.NIXOS_OZONE_WL = "1";
};
};
}

View File

@ -33,12 +33,17 @@ in
description = "adjust global desktop scale to match the activate application";
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/sway-autoscaler --loop-sec ${builtins.toString cfg.config.interval}";
ExecStart = lib.escapeShellArgs [
"env"
"SWAY_DEFAULT_SCALE=${builtins.toString cfg.config.defaultScale}"
"${cfg.package}/bin/sway-autoscaler"
"--loop-sec"
(builtins.toString cfg.config.interval)
];
Type = "simple";
Restart = "always";
RestartSec = "10s";
};
environment.SWAY_DEFAULT_SCALE = builtins.toString cfg.config.defaultScale;
};
};
}

View File

@ -479,13 +479,12 @@ in
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/swaync";
ExecStart = "env G_MESSAGES_DEBUG=all ${cfg.package}/bin/swaync";
Type = "simple";
# BusName = "org.freedesktop.Notifications";
Restart = "on-failure";
RestartSec = "10s";
};
environment.G_MESSAGES_DEBUG = "all";
};
};

View File

@ -120,12 +120,12 @@ in
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
# env G_MESSAGES_DEBUG=all
ExecStart = "${cfg.package}/bin/waybar";
Type = "simple";
Restart = "on-failure";
RestartSec = "10s";
};
# environment.G_MESSAGES_DEBUG = "all";
};
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.wvkbd;
in
@ -22,32 +22,35 @@ in
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
# --hidden: send SIGUSR2 to unhide
ExecStart = "${cfg.package}/bin/wvkbd-mobintl --hidden";
ExecStart = lib.escapeShellArgs [
"env"
# wvkbd layers:
# - full
# - landscape
# - special (e.g. coding symbols like ~)
# - emoji
# - nav
# - simple (like landscape, but no parens/tab/etc; even fewer chars)
# - simplegrid (simple, but grid layout)
# - dialer (digits)
# - cyrillic
# - arabic
# - persian
# - greek
# - georgian
"WVKBD_LANDSCAPE_LAYERS=landscape,special,emoji"
"WVKBD_LAYERS=full,special,emoji"
"WVKBD_HEIGHT=216" #< default: 250 (pixels)
# "WVKBD_LANDSCAPE_HEIGHT=??" #< default: 120 (pixels)
# more settings tunable inside config.h when compiling:
# - KBD_KEY_BORDER = 2
"${cfg.package}/bin/wvkbd-mobintl"
"--hidden"
];
Type = "simple";
Restart = "always";
RestartSec = "3s";
};
# wvkbd layers:
# - full
# - landscape
# - special (e.g. coding symbols like ~)
# - emoji
# - nav
# - simple (like landscape, but no parens/tab/etc; even fewer chars)
# - simplegrid (simple, but grid layout)
# - dialer (digits)
# - cyrillic
# - arabic
# - persian
# - greek
# - georgian
environment.WVKBD_LANDSCAPE_LAYERS = "landscape,special,emoji";
environment.WVKBD_LAYERS = "full,special,emoji";
environment.WVKBD_HEIGHT = "216"; #< default: 250 (pixels)
# environment.WVKBD_LANDSCAPE_HEIGHT = "??"; #< default: 120 (pixels)
# more settings tunable inside config.h when compiling:
# - KBD_KEY_BORDER = 2
};
};
}

View File

@ -64,16 +64,17 @@ in
# i can actually almost omit it today; problem is that if you don't set it it'll look for `sway-portals.conf` in ~/.config/xdg-desktop-portal
# but then will check its *own* output dir for {gtk,wlr}.portal.
# arguable if that's a packaging bug, or limitation...
ExecStart=''env XDG_DESKTOP_PORTAL_DIR="$HOME/.config/xdg-desktop-portal" ${cfg.package}/libexec/xdg-desktop-portal'';
ExecStart = lib.escapeShellArgs [
"env"
"XDG_DESKTOP_PORTAL_DIR=$HOME/.config/xdg-desktop-portal"
# "G_MESSAGES_DEBUG=all" #< also applies to all apps launched by the portal
"${cfg.package}/libexec/xdg-desktop-portal"
];
Type = "dbus";
BusName = "org.freedesktop.portal.Desktop";
Restart = "always";
RestartSec = "10s";
};
# environment.XDG_DESKTOP_PORTAL_DIR = "%E/xdg-desktop-portal";
# environment.G_MESSAGES_DEBUG = "all"; #< also applies to all apps launched by the portal
};
services.xdg-permission-store = {
@ -85,13 +86,16 @@ in
wantedBy = [ "xdg-desktop-portal.service" ];
serviceConfig = {
ExecStart="${cfg.package}/libexec/xdg-permission-store";
ExecStart = lib.escapeShellArgs [
"env"
"XDG_DESKTOP_PORTAL_DIR=$HOME/.config/xdg-desktop-portal"
"${cfg.package}/libexec/xdg-permission-store"
];
Type = "dbus";
BusName = "org.freedesktop.impl.portal.PermissionStore";
Restart = "always";
RestartSec = "10s";
};
environment.XDG_DESKTOP_PORTAL_DIR = "%E/xdg-desktop-portal";
};
# also available: ${cfg.package}/libexec/xdg-document-portal
# - <https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Documents.html>