summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/systemd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/systemd.nix')
-rw-r--r--accounts/gkleen@sif/systemd.nix158
1 files changed, 86 insertions, 72 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix
index c8400c28..a89b46c2 100644
--- a/accounts/gkleen@sif/systemd.nix
+++ b/accounts/gkleen@sif/systemd.nix
@@ -123,16 +123,8 @@ in {
123 }; 123 };
124 emacs = { 124 emacs = {
125 Unit = { 125 Unit = {
126 After = ["graphical-session-pre.target"]; 126 After = [ "graphical-session.target" ];
127 }; 127 BindsTo = [ "graphical-session.target" ];
128 };
129 dunst = {
130 Service = {
131 ExecStart = lib.mkForce "${cfg.services.dunst.package}/bin/dunst";
132 Restart = "always";
133 };
134 Install = {
135 WantedBy = ["graphical-session.target"];
136 }; 128 };
137 }; 129 };
138 keepassxc = { 130 keepassxc = {
@@ -144,8 +136,8 @@ in {
144 Environment = [ "QT_QPA_PLATFORM=wayland" ]; 136 Environment = [ "QT_QPA_PLATFORM=wayland" ];
145 }; 137 };
146 Unit = { 138 Unit = {
147 Requires = ["graphical-session-pre.target"]; 139 After = [ "graphical-session.target" ];
148 After = ["graphical-session-pre.target"]; 140 BindsTo = [ "graphical-session.target" ];
149 }; 141 };
150 }; 142 };
151 mpris-proxy = { 143 mpris-proxy = {
@@ -193,8 +185,8 @@ in {
193 WantedBy = ["graphical-session.target"]; 185 WantedBy = ["graphical-session.target"];
194 }; 186 };
195 Unit = { 187 Unit = {
196 Requires = ["graphical-session-pre.target"]; 188 After = [ "graphical-session.target" ];
197 After = ["graphical-session-pre.target"]; 189 PartOf = [ "graphical-session.target" ];
198 }; 190 };
199 Service = { 191 Service = {
200 ExecStart = lib.getExe pkgs.psi-notify; 192 ExecStart = lib.getExe pkgs.psi-notify;
@@ -204,23 +196,10 @@ in {
204 WatchdogSec = "2s"; 196 WatchdogSec = "2s";
205 }; 197 };
206 }; 198 };
207 polkit-gnome-authentication-agent-1 = {
208 Install = {
209 WantedBy = ["graphical-session.target"];
210 };
211 Unit = {
212 PartOf = ["graphical-session.target"];
213 Requires = ["graphical-session-pre.target"];
214 After = ["graphical-session-pre.target"];
215 };
216 Service = {
217 ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
218 Restart = "on-failure";
219 };
220 };
221 gtklock = { 199 gtklock = {
222 Unit = { 200 Unit = {
223 Requisite = ["graphical-session.target"]; 201 Requisite = ["graphical-session.target"];
202 After = [ "graphical-session.target" ];
224 PartOf = ["graphical-session.target"]; 203 PartOf = ["graphical-session.target"];
225 }; 204 };
226 Service = { 205 Service = {
@@ -228,53 +207,55 @@ in {
228 RuntimeDirectory = "gtklock"; 207 RuntimeDirectory = "gtklock";
229 CacheDirectory = "gtklock"; 208 CacheDirectory = "gtklock";
230 ExecStartPre = [ 209 ExecStartPre = [
231 "${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases" 210 "-${lib.getExe' pkgs.libsForQt5.qt5.qttools.bin "qdbus"} org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.KeePassXC.MainWindow.lockAllDatabases"
232 "${config.systemd.package}/bin/systemctl --user stop gpg-agent.service" 211 "-${lib.getExe' config.systemd.package "systemctl"} --user stop gpg-agent.service"
233 (pkgs.writeShellScript "generate-css" '' 212 "-${lib.getExe pkgs.playerctl} -a pause"
234 set -x 213 "-${lib.getExe (pkgs.writeShellApplication {
235 export PATH="${lib.makeBinPath [cfg.programs.wpaperd.package pkgs.jq pkgs.coreutils pkgs.imagemagick pkgs.findutils]}:$PATH" 214 name = "generate-css";
236 215 runtimeInputs = with pkgs; [cfg.programs.wpaperd.package jq coreutils imagemagick findutils];
237 declare -A monitors 216 text = ''
238 monitors=() 217 declare -A monitors
239 while IFS= read -r entry; do 218 monitors=()
240 path=$(jq -r ".path" <<<"$entry") 219 while IFS= read -r entry; do
241 [[ -z "$path" || ! -f "$path" ]] && continue 220 path=$(jq -r ".path" <<<"$entry")
242 blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}" 221 [[ -z "$path" || ! -f "$path" ]] && continue
243 monitor=$(jq -r ".display" <<<"$entry") 222 blurred_path="$CACHE_DIRECTORY"/"$(b2sum -l 128 <<<"$path" | cut -d' ' -f1)"."''${path##*.}"
244 if [[ ! -f "$blurred_path" ]]; then 223 monitor=$(jq -r ".display" <<<"$entry")
245 mkdir -p "$(dirname "$blurred_path")" 224 if [[ ! -f "$blurred_path" ]]; then
246 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" & 225 mkdir -p "$(dirname "$blurred_path")"
247 fi 226 magick "$path" -filter Gaussian -resize 6.25% -define filter:sigma=2.5 -resize 1600% "$blurred_path" &
248 monitors+=([$monitor]="$blurred_path") 227 fi
249 done < <(wpaperctl all-wallpapers -j | jq -c ".[]") 228 monitors+=([$monitor]="$blurred_path")
250 wait 229 done < <(wpaperctl all-wallpapers -j | jq -c ".[]")
230 # wait
251 231
252 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" '' 232 cp --no-preserve=mode ${pkgs.writeText "gtklock.css" ''
253 #window-box { 233 #window-box {
254 padding: 64px; 234 padding: 64px;
255 /* border: 1px solid black; */ 235 /* border: 1px solid black; */
256 border-radius: 4px; 236 border-radius: 4px;
257 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px; 237 box-shadow: rgba(0, 0, 0, 0.8) 0px 4px 12px;
258 /* background-color: white; */ 238 /* background-color: white; */
259 background-color: rgba(0, 0, 0, 0.5); 239 background-color: rgba(0, 0, 0, 0.5);
240 }
241 ''} "$RUNTIME_DIRECTORY"/style.css
242 for monitor in "''${!monitors[@]}"; do
243 cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF
244 window#''${monitor} {
245 background-image: url("''${monitors[$monitor]}");
246 background-repeat: no-repeat;
247 background-size: 100% 100%;
248 background-origin: content-box;
260 } 249 }
261 ''} "$RUNTIME_DIRECTORY"/style.css 250 EOF
262 for monitor in "''${!monitors[@]}"; do 251 done
263 cat >>"$RUNTIME_DIRECTORY"/style.css <<EOF 252 '';
264 window#''${monitor} { 253 })}"
265 background-image: url("''${monitors[$monitor]}");
266 background-repeat: no-repeat;
267 background-size: 100% 100%;
268 background-origin: content-box;
269 }
270 EOF
271 done
272 '')
273 ]; 254 ];
274 NotifyAccess = "all"; 255 NotifyAccess = "all";
275 ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" '' 256 ExecStart = ''${lib.getExe pkgs.gtklock} -s "''${RUNTIME_DIRECTORY}/style.css" -L ${pkgs.writeShellScript "after-lock" ''
276 ${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off 257 ${lib.getExe cfg.programs.niri.package} msg action power-off-monitors
277 ${config.systemd.package}/bin/systemd-notify --ready 258 ${lib.getExe' config.systemd.package "systemd-notify"} --ready
278 ''}''; 259 ''}'';
279 }; 260 };
280 }; 261 };
@@ -327,8 +308,8 @@ in {
327 WantedBy = ["graphical-session.target"]; 308 WantedBy = ["graphical-session.target"];
328 }; 309 };
329 Unit = { 310 Unit = {
330 BindsTo = ["graphical-session-pre.target"]; 311 After = [ "graphical-session.target" ];
331 After = ["graphical-session-pre.target"]; 312 PartOf = [ "graphical-session.target" ];
332 }; 313 };
333 Service = { 314 Service = {
334 ExecStart = lib.getExe cfg.programs.wpaperd.package; 315 ExecStart = lib.getExe cfg.programs.wpaperd.package;
@@ -337,6 +318,36 @@ in {
337 RestartSec = "2s"; 318 RestartSec = "2s";
338 }; 319 };
339 }; 320 };
321 xembed-sni-proxy = {
322 Unit = {
323 PartOf = lib.mkForce ["tray.target"];
324 BindsTo = ["xwayland-satellite.service"];
325 After = ["xwayland-satellite.service"];
326 };
327 };
328 poweralertd = {
329 Unit = {
330 After = ["graphical-session.target"];
331 };
332 };
333 network-manager-applet = {
334 Unit = {
335 PartOf = lib.mkForce ["tray.target"];
336 };
337 };
338 udiskie = {
339 Unit = {
340 PartOf = lib.mkForce ["tray.target"];
341 };
342 };
343 blueman-applet = {
344 Unit = {
345 PartOf = lib.mkForce ["tray.target"];
346 };
347 Install = {
348 WantedBy = lib.mkForce ["tray.target"];
349 };
350 };
340 } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { 351 } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" {
341 Unit = { 352 Unit = {
342 Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; 353 Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"];
@@ -387,6 +398,9 @@ in {
387 }; 398 };
388 tray = { 399 tray = {
389 Unit = { 400 Unit = {
401 PartOf = [ "graphical-session.target" ];
402 Requires = [ "waybar.service" ];
403 After = [ "graphical-session.target" "waybar.service" ];
390 Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; 404 Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"];
391 }; 405 };
392 }; 406 };