From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id uMNcMR9Se2dZPQAAqHPOHw:P1 (envelope-from ) for ; Mon, 06 Jan 2025 03:46:40 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id uMNcMR9Se2dZPQAAqHPOHw (envelope-from ) for ; Mon, 06 Jan 2025 04:46:39 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DDpvmd8d; 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=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736135199; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=l3W3hk+KJbeJMD3VJtinb1kyAx1hDwy3Iry6rh9T8N0=; b=rVV/Pe8WE7RBU7kB4eT2W1zOksa3fUKT7ojonwED4QGifwGaiX18nLg7G9xz63gyQMMNv+ rLZUWYSD+pkOkhUNmRVFlRkgnCIzcsvjA5PtCbg18DRlXqfoXmH9cwvutS8WItXCqV7Dki m4VxnHxDolQi+QmbBSlDPsOpmOsae1qeA7ggCP+oRFGxylkJd/LDDwG6yV6tzNfSYBcEX6 BMQmm2L2aKPXzBBpSbxQnH8TPV4op5/wn34qWL7cKAL+90A++Odx6Nm24odW6aHxZ0/7ec jgaPXMvhZmUKz99rQ3piP+M5O5Wu4ApfJNMtdf4rwpFVLrXQ2zhz86pyhdy2GA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=DDpvmd8d; 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=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736135199; a=rsa-sha256; cv=none; b=sD1a5smyWPAmDLJZiPdhb2QWxlyM773C9eXZKMNIeSqvoMUrIhPpO8m8bSCAIklsl3JwzB Lr4xJHPg3/wH8m/u7BBwQGlqo/YgqnbZCzt5I9vWqivePc00KDJM8t7Ph11pHOxzvD1jjW dsHTJSwiM7/zUCz4K/Nx1B85yJ1JIBzZjdRdzOHRVE54HouOBXpSeh23vp+MkRg5DIs6KH KIhxooQLZD+AyWfLipyB3Fb7ATy80AwYeI9qZPnqdayASO4t4KtLyDRTwuH8V3fAqFpePB 05PVF1ZSjRxF6pPDWtTriF08YpGnjVCzbUrppW2ytvMTs16RMVzTqbZ7t1LIjg== 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 615FD32D74 for ; Mon, 06 Jan 2025 04:46:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUe3o-0004nz-E7; Sun, 05 Jan 2025 22:45:48 -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 1tUe3j-0004ne-7a for help-guix@gnu.org; Sun, 05 Jan 2025 22:45:44 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUe3g-0008IN-QC for help-guix@gnu.org; Sun, 05 Jan 2025 22:45:42 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id DB16B240101 for ; Mon, 6 Jan 2025 04:45:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736135135; bh=0Nc9BrGwZkPExNyleyy+eQckVtqU7kvcb7jvMN1GdWQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=DDpvmd8dn0tGvCaoSXkbs4WLwjVgk9hwkJ7WNIcl0TzealMxgATNrDxeZlAp4R9Dm V0ozOIHjaBZjTjRLzUMQvMnnEObGDhXSYxTBBT0nLOe1C/7YVBDodUQRZ88X8yUbKg 5j1E7eIptre3m5RfjcSJzaYO94FWUMwYq+COu5rRfKb51xBB9WUnIL/WWPu0xceb50 Ayy5zVP/jnzynLoXSiNc+0frJU/roCW+Xe547cxATJYFZNhH6+07WtacBjuOsSeXBg RdkABspjp5Nfp0hcyHVrbHe3sh4XV50sVghqVwM9YsoHpcHJjiKczhhbSFFhsoAo3U +Nql7pvCuypdA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YRKp705HQz6tvw for ; Mon, 6 Jan 2025 04:45:34 +0100 (CET) From: Fredrik Salomonsson To: help-guix Subject: Shepherd environment question Date: Mon, 06 Jan 2025 03:45:32 +0000 Message-ID: <875xmsfvvn.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=plattfot@posteo.net; helo=mout02.posteo.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_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -2.97 X-Spam-Score: -2.97 X-Migadu-Queue-Id: 615FD32D74 X-TUID: 6ZPdEBqGEcbw Hi Guix, After reading the Shepherd 1.0.0 blog post [0], it got me thinking that with the log rotation etc it would be nice to let shepherd handle sway and the programs it launches. As right now I got a simple line in my ~/.bash_profile that if logging in to tty1 exec sway. And all the output from sway and its program just outputs into the ether. So 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: Sway launches fine when I login, and I can now see some logs when checking the status:=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/sway It is enabled. Provides: sway Will be respawned. Log file: /home/plattfot/.local/state/log/sway.log Recent messages (use '-n' to view more or less): 2025-01-05 18:46:15 (process:1425): GLib-CRITICAL **: 18:46:15.714: g_str= ing_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] Unha= ndled message 'new: ID=3Drofi/|gnu|store|9z44nwi28zvw3cay7m9q6388b26d74kd-e= macs-pgtk-29.4|bin|emacs/1425-0-surt_TIME43379 SCREEN=3D0 NAME=3DEmacs DESC= RIPTION=3DLaunching\ '/gnu/store/9z44nwi28zvw3cay7m9q6388b26d74kd-emacs-pgt= k-29.4/bin/emacs'\ via\ rofi WMCLASS=3DEmacs BIN=3D/gnu/store/9z44nwi28zvw3= cay7m9q6388b26d74kd-emacs-pgtk-29.4/bin/emacs ICON=3Demacs APPLICATION_ID= =3Demacs' 2025-01-05 18:46:15=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 extension), se= quence 173, value 4194320 2025-01-05 18:46:21 warn: wayland.c:1619: compositor does not implement t= he XDG toplevel icon protocol ``` Pretty cool! =F0=9F=A4=93 However, 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 from = the swayidle log: ``` 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 WAYLAND_DIS= PLAY environment variable. ``` What 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 way? Thanks! Here is what I got so far: ~/.bash_profile ``` # Start sway when logging in on tty if [ "$(tty)" =3D "/dev/tty1" ]; then herd start sway fi ``` My 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.")) (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? con= fig))) (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/sway= lock -f -c 000000") "before-sleep" (string-append #$swaylock "/bin/swayl= ock -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-envi= ronment") "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_ST= ATE_HOME")))) (stop #~(make-kill-destructor))))) ``` [0] https://guix.gnu.org/blog/2024/the-shepherd-1.0.0-released --=20 s/Fred[re]+i[ck]+/Fredrik/g