From cddba3d35f81bd18d5a65f1fdd5395d82a8b34dd Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 5 Sep 2023 08:31:50 +0000 Subject: [PATCH] conky: ship on sway this probably causes double conky on sxmo, but i can fix in future patch --- .../programs/conky}/battery_estimate | 0 .../programs/conky/conky.conf} | 0 hosts/common/programs/conky/default.nix | 36 +++++++++++++++++++ hosts/common/programs/default.nix | 1 + hosts/modules/gui/sway/default.nix | 1 + hosts/modules/gui/sxmo/default.nix | 12 ++----- 6 files changed, 40 insertions(+), 10 deletions(-) rename hosts/{modules/gui/sxmo => common/programs/conky}/battery_estimate (100%) rename hosts/{modules/gui/sxmo/conky-config => common/programs/conky/conky.conf} (100%) create mode 100644 hosts/common/programs/conky/default.nix diff --git a/hosts/modules/gui/sxmo/battery_estimate b/hosts/common/programs/conky/battery_estimate similarity index 100% rename from hosts/modules/gui/sxmo/battery_estimate rename to hosts/common/programs/conky/battery_estimate diff --git a/hosts/modules/gui/sxmo/conky-config b/hosts/common/programs/conky/conky.conf similarity index 100% rename from hosts/modules/gui/sxmo/conky-config rename to hosts/common/programs/conky/conky.conf diff --git a/hosts/common/programs/conky/default.nix b/hosts/common/programs/conky/default.nix new file mode 100644 index 00000000..9329af82 --- /dev/null +++ b/hosts/common/programs/conky/default.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: +{ + sane.programs.conky = { + 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"; + }; + }; + + # TODO: give `sane.programs` native support for defining services + systemd.user.services.conky = lib.mkIf config.sane.programs.conky.enabled { + 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" ]; + # TODO: might want `ConditionUser=!@system` + + serviceConfig.ExecStart = "${pkgs.conky}/bin/conky"; + serviceConfig.Type = "simple"; + serviceConfig.Restart = "on-failure"; + serviceConfig.RestartSec = "10s"; + # serviceConfig.Slice = "session.slice"; + + # don't start conky until after sway + preStart = ''test -n "$SWAYSOCK"''; + }; +} diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index e98e9e79..0a195fcd 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -7,6 +7,7 @@ ./assorted.nix ./cantata.nix ./chatty.nix + ./conky ./cozy.nix ./dino.nix ./element-desktop.nix diff --git a/hosts/modules/gui/sway/default.nix b/hosts/modules/gui/sway/default.nix index 5d5de215..e226a743 100644 --- a/hosts/modules/gui/sway/default.nix +++ b/hosts/modules/gui/sway/default.nix @@ -117,6 +117,7 @@ in package = null; suggestedPrograms = [ "guiApps" + "conky" # for a nice background "splatmoji" # used by us, but 'enabling' it gets us persistence & cfg "swaylock" "swayidle" diff --git a/hosts/modules/gui/sxmo/default.nix b/hosts/modules/gui/sxmo/default.nix index 7fc16416..9a2676d1 100644 --- a/hosts/modules/gui/sxmo/default.nix +++ b/hosts/modules/gui/sxmo/default.nix @@ -339,16 +339,8 @@ in in lib.generators.toKeyValue { inherit mkKeyValue; } cfg.settings; - sane.user.fs.".config/sxmo/conky.conf".symlink.target = let - battery_estimate = pkgs.static-nix-shell.mkBash { - pname = "battery_estimate"; - src = ./.; - }; - in pkgs.substituteAll { - src = ./conky-config; - bat = "${battery_estimate}/bin/battery_estimate"; - weather = "timeout 20 ${pkgs.sane-weather}/bin/sane-weather"; - }; + sane.user.fs.".config/sxmo/conky.conf".symlink.target + = "../conky/conky.conf"; } (lib.mkIf (cfg.greeter == "lightdm-mobile") {