From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id N4bZL3uCfmc3FAEAqHPOHw:P1 (envelope-from ) for ; Wed, 08 Jan 2025 13:49:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id N4bZL3uCfmc3FAEAqHPOHw (envelope-from ) for ; Wed, 08 Jan 2025 14:49:47 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=V1kvTHvV; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=dismail.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736344186; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=lKPf2wqZH8ixN8tIaw2DqfeJ0XHlh+vYlLrsh/uKzPY=; b=uSI602HvZvSRa6VG79iCnVMCXKo3IEAcsCWQbYcyB5pwuBy3TIsiPuS8bUpjOZIMVFxmlR Jy82Kerc4G8PR2+hdz6lemFy4qntgazb9pjWdzoSL60OVTivw/6+/K1ceTiE4+7Z6PgGRj 6m88mV4UxGLlTkqHf/u9F+XgQYUYSZAdrTYZhgaqNKefNtS/Fm5j2xEIxq3a35xaI6tKlh iFSNUFjMRCM7Lgf8OeGrsD26hkJwVcohMR+Z3tkoaY5aNpph4Ag9ELlQwGmtf6GJIHNtrj OA5JFKcvwdWaTvKh5d4fI9CLJegqKlFiDtbN8Q2I5ioNqrhwTO5flUBpD8t8KQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=V1kvTHvV; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=dismail.de ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736344186; a=rsa-sha256; cv=none; b=WLJnvGdgjNd3jiSjL1vo/bXAskW32DApUF3RPARQJLWXKNIhGIqYJs51nGC1+u403E1Riq LSfkMj3sAKnElAzGcONR3wJocjb5cW8xGXcieeF9XpZ4pKizIiZScUo/GUsJO1VcxsBAEK lhrw542yUtJjUUQdabJA6JRb+Awp9PSriktjUnpxqZkMdusMvvDyMIYw+dReAypZsG9w8Z 4ygYZTgyxyT9JznN3NVInBd0ELHLU31BVvVrQso5fDTxOhMmnAVkrs0Ytyfj2utJB416Gg 5WmvMx/3pdg4ckkQRizEQ8Virgi7wChRMl6mc8wryUE9oqFoGQr8etGz8XfwKw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8A39E90E77 for ; Wed, 08 Jan 2025 14:49:46 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVWR3-00049t-V5; Wed, 08 Jan 2025 08:49:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVWR2-00047m-Bj for help-guix@gnu.org; Wed, 08 Jan 2025 08:49:24 -0500 Received: from mx2.dismail.de ([159.69.191.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVWQv-00034H-9J for help-guix@gnu.org; Wed, 08 Jan 2025 08:49:24 -0500 Received: from mx2.dismail.de (localhost [127.0.0.1]) by mx2.dismail.de (OpenSMTPD) with ESMTP id 07420fc5; Wed, 8 Jan 2025 14:49:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h= mime-version:date:content-type:content-transfer-encoding:from :message-id:subject:to:in-reply-to:references; s=20190914; bh=iY jT4/kqNAwnn+SYOHLUaV1Xtl2bgJYfTWPeKGAwU7Y=; b=V1kvTHvVLjPV0a+eem 9e/THpQwlaNOY8Dpu53+Gl9WtWfcC75DxZ4kMgW1JDmX0lCUPrFcyBgrZCeYhISB sqxo0M/b0UIZbB5h34En0m7U/5Ej/uoa0ztozwRTq8oZGTdYl1sbxuT0sUWzu1XB DkHaoWQImW1yQnn/s+LpTn5yMg9voZXeqnfwjjs8C0qa+xC7fp8yofI5UXOAm7p9 4VG6mIeuCIWvJC5P8zeS+w34OYUj1bJcgYaGn8gduEXvVNgAc7cXdgUTzBS5Fo3z VSzCXrz+l+fg+EzwwYcpD7fQ5hxLntA9A85BMWUBslASZ484MJuhE6yzvK71emdR blKg== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx2.dismail.de (OpenSMTPD) with ESMTP id 4ad89108; Wed, 8 Jan 2025 14:49:15 +0100 (CET) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id 79e71b8b; Wed, 8 Jan 2025 14:49:14 +0100 (CET) Received: by dismail.de (OpenSMTPD) with ESMTPSA id ee7baa09 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 8 Jan 2025 14:49:14 +0100 (CET) MIME-Version: 1.0 Date: Wed, 08 Jan 2025 13:49:13 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: jbranso@dismail.de Message-ID: <318957a3fcd213580542bb223cb7f6e7de7a9200@dismail.de> TLS-Required: No Subject: Re: Shepherd environment question To: "Fredrik Salomonsson" , "help-guix" In-Reply-To: <875xmsfvvn.fsf@posteo.net> References: <875xmsfvvn.fsf@posteo.net> Received-SPF: pass client-ip=159.69.191.136; envelope-from=jbranso@dismail.de; helo=mx2.dismail.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -8.76 X-Spam-Score: -8.76 X-Migadu-Queue-Id: 8A39E90E77 X-Migadu-Scanner: mx10.migadu.com X-TUID: hnsCHfbYz36d January 5, 2025 at 10:45 PM, "Fredrik Salomonsson" wrote: >=20 >=20Hi Guix, >=20 >=20After reading the Shepherd 1.0.0 blog post [0], it got me thinking th= at > with the log rotation etc it would be nice to let shepherd handle sway > and the programs it launches. >=20 >=20As right now I got a simple line in my ~/.bash_profile that if loggin= g > in to tty1 exec sway. And all the output from sway and its program just > outputs into the ether. >=20 >=20So I migrated all the programs that sway launches from the config to > shepherd services. And made a shepherd service for sway but disable the > auto-start for it. So that I can kick it off with my .bash_profile: If guix doesn't already have a sway-service (home-service or system service), then it might be a good idea to throw this patch to guix-patches@gnu.org. Joshua >=20 >=20Sway launches fine when I login, and I can now see some logs when > checking the status:=20 >=20 > ``` > herd status sway > =E2=97=8F Status of sway: > It is running since 18:45:58 (27 seconds ago). > Main PID: 1100 > Command: /gnu/store/c990qdj2nqcgfif7qs2gnyfbshskkp4y-sway-1.10/bin/swa= y > It is enabled. > Provides: sway > Will be respawned. > Log file: /home/plattfot/.local/state/log/sway.log >=20 >=20Recent messages (use '-n' to view more or less): > 2025-01-05 18:46:15 (process:1425): GLib-CRITICAL **: 18:46:15.714: g_= string_insert_len: assertion 'len =3D=3D 0 || val !=3D NULL' failed > 2025-01-05 18:46:15 00:00:16.666 [ERROR] [wlr] [xwayland/xwm.c:1500] U= nhandled message 'new: ID=3Drofi/|gnu|store|9z44nwi28zvw3cay7m9q6388b26d7= 4kd-emacs-pgtk-29.4|bin|emacs/1425-0-surt_TIME43379 SCREEN=3D0 NAME=3DEma= cs DESCRIPTION=3DLaunching\ '/gnu/store/9z44nwi28zvw3cay7m9q6388b26d74kd-= emacs-pgtk-29.4/bin/emacs'\ via\ rofi WMCLASS=3DEmacs BIN=3D/gnu/store/9z= 44nwi28zvw3cay7m9q6388b26d74kd-emacs-pgtk-29.4/bin/emacs ICON=3Demacs APP= LICATION_ID=3Demacs' > 2025-01-05 18:46:15=20 >=20 2025-01-05 18:46:15 00:00:16.666 [ERROR] [wlr] [xwayland/xwm.c:1633]= xcb error: op ChangeWindowAttributes (no minor), code Window (no extensi= on), sequence 173, value 4194320 > 2025-01-05 18:46:21 warn: wayland.c:1619: compositor does not implemen= t the XDG toplevel icon protocol >=20 >=20``` >=20 >=20Pretty cool! =F0=9F=A4=93 >=20 >=20However, the programs that requires a running wayland session did not > go that well =E2=80=94 for example mako and swayidle. Here is a line fr= om the > swayidle log: >=20 >=20``` > 2025-01-05 18:29:34 2025-01-05 18:29:34 - [Line 1096] Unable to connect= to the compositor. If your compositor is running, check or set the WAYLA= ND_DISPLAY environment variable. > ``` >=20 >=20What I think I need to do to run them properly, is to run them in the > environment sway creates. The `make-forkexec-constructor` does have a > `#:environment-variables` argument so I need to somehow extract the > environment variables required from the sway service and feed that into > the constructor for the services that require a wayland session. Anyone > have any idea how to set that up? Or am I going about this the wrong wa= y? >=20 >=20Thanks! >=20 >=20Here is what I got so far: >=20 >=20~/.bash_profile > ``` > # Start sway when logging in on tty > if [ "$(tty)" =3D "/dev/tty1" ]; then > herd start sway > fi >=20 >=20``` >=20 >=20My sway shepherd services: > ``` > (define-configuration/no-serialization plt-sway-configuration > (turn-off-displays? > (boolean #t) > "Specify if it should turn off the displays when the machine is idle."= )) >=20 >=20(define (plt-sway-shepherd config) > (list > (shepherd-service > (provision '(sway)) > (documentation "Start sway") > (auto-start? #f) > (start #~(make-forkexec-constructor > (list (string-append #$sway "/bin/sway")) > #:log-file (format #f "~a/log/sway.log" > (getenv "XDG_STATE_HOME")))) > (stop #~(make-kill-destructor))) > (let ((turn-off-displays? (plt-sway-configuration-turn-off-displays? c= onfig))) > (shepherd-service > (requirement '(sway)) > (provision '(swayidle)) > (documentation (string-append "Lock screen after 5 min" > (if turn-off-displays? > "and turn them off after 10 min." > "."))) > (start #~(make-forkexec-constructor > (append > (list (string-append #$swayidle "/bin/swayidle") "-w") > (if #$turn-off-displays? > '("timeout" "600" "swaymsg 'output * dpms off'" > "resume" "swaymsg 'output * dpms on'") > '()) > (list "timeout" "300" (string-append #$swaylock "/bin/swaylock -f -c 0= 00000") > "before-sleep" (string-append #$swaylock "/bin/swaylock -f -c 000000")= )) > #:log-file (format #f "~a/log/swayidle.log" (getenv "XDG_STATE_HOME"))= )) > (stop #~(make-kill-destructor)))) > (shepherd-service > (provision '(waybar)) > (requirement '(sway)) > (documentation "Start waybar.") > (start #~(make-forkexec-constructor > (list (string-append #$waybar "/bin/waybar")) > #:log-file (format #f "~a/log/waybar.log" > (getenv "XDG_STATE_HOME")))) > (stop #~(make-kill-destructor))) > (shepherd-service > (provision '(mako)) > (requirement '(sway)) > (documentation "Start mako; lightweight Wayland notification daemon.") > (start #~(make-forkexec-constructor > (list (string-append #$mako "/bin/mako")) > #:log-file (format #f "~a/log/mako.log" > (getenv "XDG_STATE_HOME")))) > (stop #~(make-kill-destructor))) > (shepherd-service > (provision '(dbus-update-activation-environment)) > (requirement '(dbus sway)) > (documentation "Tell dbus that we are using sway") > (one-shot? #t) > (start #~(make-forkexec-constructor > (list (string-append #$dbus "/bin/dbus-update-activation-environment") > "DISPLAY SWAYSOCK" > "WAYLAND_DISPLAY" > "XDG_CURRENT_DESKTOP=3Dsway") > #:log-file (format #f "~a/log/dbus-activate-environment.log" > (getenv "XDG_STATE_HOME")))) > (stop #~(make-kill-destructor))) > (shepherd-service > (requirement '(sway)) > (provision '(playerctld)) > (documentation "Controll the latest active player over MPRIS") > (start #~(make-forkexec-constructor > (list (string-append #$playerctl "/bin/playerctld")) > #:log-file (format #f "~a/log/playerctld.log" (getenv "XDG_STATE_HOME"= )))) > (stop #~(make-kill-destructor))))) > ``` >=20 >=20[0] https://guix.gnu.org/blog/2024/the-shepherd-1.0.0-released >=20 >=20--=20 >=20s/Fred[re]+i[ck]+/Fredrik/g >