From 9ca5d889b056a2a2e0e8ff7a93641aa5697b6d2c Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 28 Sep 2024 22:39:47 +0530 Subject: [PATCH] skipper: eww, the nix way --- home/wm/addon/eww/config/eww.yuck | 7 ++-- home/wm/addon/eww/default.nix | 61 ++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/home/wm/addon/eww/config/eww.yuck b/home/wm/addon/eww/config/eww.yuck index 68fd6c2..61da8ad 100644 --- a/home/wm/addon/eww/config/eww.yuck +++ b/home/wm/addon/eww/config/eww.yuck @@ -1,11 +1,12 @@ -(defwindow activate-notice +(defwindow default :monitor 0 :geometry (geometry :x "20px" :y "20px" :width "200px" :height "50px" :anchor "bottom right") - :stacking "fg" + :stacking "bottom" :exclusive false :focusable false -"Test driving eww!") +"@test_string@") + diff --git a/home/wm/addon/eww/default.nix b/home/wm/addon/eww/default.nix index 49d53f4..12f2c8e 100644 --- a/home/wm/addon/eww/default.nix +++ b/home/wm/addon/eww/default.nix @@ -1,6 +1,63 @@ -_: { +{ lib, config, pkgs, ... }: +let + configFile = pkgs.substituteAll { + src = ./config/eww.yuck; + test_string = "Testing Out Eww!"; + }; + + cssFile = ./config/eww.scss; + + configDir = _: pkgs.stdenvNoCC.mkDerivation { + name = "eww-config"; + + srcs = [ configFile cssFile ]; + dontUnpack = true; + + installPhase = '' + mkdir -p $out + for src in $srcs; do + cp "$src" $out/$(stripHash "$src") + done + ''; + }; +in +{ programs.eww = { enable = true; - configDir = ./config; + configDir = pkgs.callPackage configDir { }; + }; + systemd.user.services = { + eww = { + Unit = { + Description = "ElKowars wacky widgets - daemon"; + Documentation = "https://elkowar.github.io/eww/"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session-pre.target" ]; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${lib.getExe config.programs.eww.package} daemon --no-daemonize --logs"; + Restart = "on-failure"; + KillMode = "mixed"; + }; + }; + eww-widgets = { + Unit = { + Description = "ElKowars wacky widgets"; + Documentation = "https://elkowar.github.io/eww/"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session-pre.target" ]; + Requires = [ "eww.service" ]; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "${lib.getExe config.programs.eww.package} open activate-notice"; + }; + }; }; }