2023-09-12 04:44:38 +00:00
|
|
|
{ config, pkgs, ... }:
|
2023-09-05 08:31:50 +00:00
|
|
|
{
|
|
|
|
sane.programs.conky = {
|
2024-01-23 00:58:56 +00:00
|
|
|
# TODO: non-sandboxed `conky` still ships via `sxmo-utils`, but unused
|
2024-01-23 12:11:22 +00:00
|
|
|
sandbox.method = "bwrap";
|
2024-01-23 14:34:23 +00:00
|
|
|
sandbox.extraPaths = [
|
|
|
|
"/sys/class/power_supply"
|
|
|
|
"/sys/devices" # needed by battery_estimate
|
|
|
|
# "/sys/devices/cpu"
|
|
|
|
# "/sys/devices/system"
|
|
|
|
];
|
2023-09-05 08:31:50 +00:00
|
|
|
fs.".config/conky/conky.conf".symlink.target =
|
|
|
|
let
|
|
|
|
battery_estimate = pkgs.static-nix-shell.mkBash {
|
|
|
|
pname = "battery_estimate";
|
|
|
|
src = ./.;
|
|
|
|
};
|
|
|
|
in pkgs.substituteAll {
|
|
|
|
src = ./conky.conf;
|
|
|
|
bat = "${battery_estimate}/bin/battery_estimate";
|
|
|
|
weather = "timeout 20 ${pkgs.sane-weather}/bin/sane-weather";
|
|
|
|
};
|
|
|
|
|
2023-09-12 04:44:38 +00:00
|
|
|
services.conky = {
|
|
|
|
description = "conky dynamic desktop background";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
# XXX: should be part of graphical-session.target, but whatever mix of greetd/sway
|
|
|
|
# i'm using means that target's never reached...
|
|
|
|
# wantedBy = [ "graphical-session.target" ];
|
|
|
|
# partOf = [ "graphical-session.target" ];
|
2023-09-05 08:31:50 +00:00
|
|
|
|
2023-09-12 04:44:38 +00:00
|
|
|
serviceConfig.ExecStart = "${config.sane.programs.conky.package}/bin/conky";
|
|
|
|
serviceConfig.Type = "simple";
|
|
|
|
serviceConfig.Restart = "on-failure";
|
|
|
|
serviceConfig.RestartSec = "10s";
|
|
|
|
# serviceConfig.Slice = "session.slice";
|
2023-09-05 08:31:50 +00:00
|
|
|
|
2023-09-12 04:44:38 +00:00
|
|
|
# don't start conky until after sway
|
|
|
|
preStart = ''test -n "$SWAYSOCK"'';
|
|
|
|
};
|
2023-09-05 08:31:50 +00:00
|
|
|
};
|
|
|
|
}
|