From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0OwdGwfDWmP/bAEAbAwnHQ (envelope-from ) for ; Thu, 27 Oct 2022 19:42:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KAE0GwfDWmOfKwAA9RJhRA (envelope-from ) for ; Thu, 27 Oct 2022 19:42:31 +0200 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 1F02318D53 for ; Thu, 27 Oct 2022 19:42:31 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oo6qq-0000RI-HR; Thu, 27 Oct 2022 13:39:32 -0400 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 1oo6qN-0006ML-6U for guix-patches@gnu.org; Thu, 27 Oct 2022 13:39:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oo6qM-00026p-V5 for guix-patches@gnu.org; Thu, 27 Oct 2022 13:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oo6qM-0003lh-QP for guix-patches@gnu.org; Thu, 27 Oct 2022 13:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58818] [PATCH 1/1] gnu: home: greetd-service-type: Add gexp compilers for sessions. References: <20221027173526.25556-1-paren@disroot.org> In-Reply-To: <20221027173526.25556-1-paren@disroot.org> Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Oct 2022 17:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58818 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58818@debbugs.gnu.org Cc: "\(" Received: via spool by 58818-submit@debbugs.gnu.org id=B58818.166689230514416 (code B ref 58818); Thu, 27 Oct 2022 17:39:02 +0000 Received: (at 58818) by debbugs.gnu.org; 27 Oct 2022 17:38:25 +0000 Received: from localhost ([127.0.0.1]:59239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oo6pl-0003kN-7O for submit@debbugs.gnu.org; Thu, 27 Oct 2022 13:38:25 -0400 Received: from knopi.disroot.org ([178.21.23.139]:57206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oo6pe-0003k9-Up for 58818@debbugs.gnu.org; Thu, 27 Oct 2022 13:38:19 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 4157D4E7E6; Thu, 27 Oct 2022 19:38:18 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W16P3koH1zNa; Thu, 27 Oct 2022 19:38:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1666892295; bh=HXrJb21dZoMrPKuFQOlaI6jXLA9t2Rpd59gggNZaU9w=; h=From:To:Cc:Subject:Date; b=KVZ2+v8SRKBXEApM1gpIJ+EMSp89R9U9AxzBMvVu1FDvn1scUKRrl3R3Nkzq1t3wt 4MrrVOKUrv7Iss2kbskSSn1RwxNdklBGWuAle34CtUUMwwuGYmSd+FuSDeSmkh4JXu BoA6D/M/T7iAYmFXFY5G4+/ZU3ELc4hYHMMJU2CAosO4oaBenuo+cjc+EOapV9CMOW LsfiiRxXymm9GNRC1m79iPNqpDvnYheQi0aPgBbcrVQZsmNAexmECeXfMuFCBFpNtS Hp2xJEa1pxyQ0+kFa2HLI50KiahXE/lcxMvUbQMw00sYOBxz2H/ulBtBnM1EyFd+DU XQdYQoqViutoQ== Date: Thu, 27 Oct 2022 18:38:09 +0100 Message-Id: <20221027173809.25625-1-paren@disroot.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Guix-patches" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" From: "\( via Guix-patches" via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666892551; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=SvJhSV8KFz2avgzOCZbt6E36DBcwCNHfaSxULohuyi4=; b=GgDTo+Li60fU1HzqgjIueX4kxQZxbkcBKrnionuLPEAgSCc62QGiAGrHrMj7w6vlzTBXDp 2bXw4zodPzKvYG7gEIdxDQIJUF8fLgjEHqSMwTnYHpmEK8KzG8zwRdkWHZloiA3wpxjkQF bHirx9rF6c66HjaW0SWdwSy1K/Z5Dr3Wj3T70XXwr0V+W9ml1jLuAH8gEineGwl/v5VNBm 7bP+zYddVjPB2mlnwt2/s6Re9N16mBodvMjAr3TOg9YEc+b5gnh67VyVVE0RTfMBusyrCO o4ySPqaBmy2oWOmv2mRCdzZ52vvJ6u86Ks3/Vo5LwkDDKR9czSmZdGLYZhO50w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666892551; a=rsa-sha256; cv=none; b=SKCUZdhfPvQAn9vGNtNX6OA+iomjvUVhCes4U79DUAyntHAuy1gpnQ+Z5JvEf6tW0LAKfC HQcd4H7YzRrfDmQKAzhtKb075lOCGRlK15Q9B409dNryXYY6z37Gr8QCJvkl4JjTRSM3M5 OsOvNVX58IQdixq0WGk6/1oS4ZEtvBA37qiievgCpq7dSKYRLVpZQM+BDbSKfRDDrX2uLk JXQYXVJghjaZShOHRomFhpzxjm2Mewxlub/zlsq7sr7X8+MkKPhTOKZC4nGeF3uZv7z5Vy Sw+D1Tw3UdJJSnJMaOIvsJEIwuzrG5H5Xdp4QFxVESGC6oZG2fLfobxTi1GO/A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=KVZ2+v8S; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.22 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=KVZ2+v8S; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1F02318D53 X-Spam-Score: -1.22 X-Migadu-Scanner: scn0.migadu.com X-TUID: Xj7LtSAvP/A2 * gnu/home/services/base.scm (make-greetd-agreety-session-command, greetd-wlgreet-sway-session-command, make-greetd-default-session-command): Remove variables. (greetd-agreety-session-compiler, greetd-wlgreet-sway-session-compiler): New gexp compilers. (greetd-terminal-configuration)[default-session-command]: Remove it. --- gnu/services/base.scm | 65 ++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d3e3335030..3bf924b8f1 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2900,11 +2900,18 @@ (define greetd-agreety-tty-xdg-session-command (quote (#$@extra-env))) (apply execl #$command #$command (list #$@args))))))) -(define (make-greetd-agreety-session-command config command) - (let ((agreety (file-append (greetd-agreety config) "/bin/agreety"))) - (program-file - "agreety-command" - #~(execl #$agreety #$agreety "-c" #$command)))) +(define-gexp-compiler (greetd-agreety-session-compiler + (session ) + system target) + (let ((agreety (file-append (greetd-agreety session) + "/bin/agreety")) + (command ((if (greetd-agreety-xdg-env? session) + greetd-agreety-tty-xdg-session-command + greetd-agreety-tty-session-command) + session))) + (lower-object + (program-file "agreety-command" + #~(execl #$agreety #$agreety "-c" #$command))))) (define-record-type* greetd-wlgreet-session make-greetd-wlgreet-session @@ -2991,37 +2998,26 @@ (define (make-wlgreet-sway-configuration-file session) "exec \"" wlgreet " --config " wlgreet-config "; " swaymsg " exit\"\n"))) -(define (greetd-wlgreet-sway-session-command session) +(define-gexp-compiler (greetd-wlgreet-sway-session-compiler + (session ) + system target) (let ((sway (file-append (greetd-wlgreet-sway-session-sway session) "/bin/sway")) (config (make-wlgreet-sway-configuration-file session))) - (program-file "wlgreet-sway-session-command" - #~(let* ((log-file (open-output-file - (string-append "/tmp/sway-greeter." - (number->string (getpid)) - ".log"))) - (username (getenv "USER")) - (useruid (number->string (passwd:uid (getpwuid username))))) - ;; redirect stdout/err to log-file - (dup2 (fileno log-file) 1) - (dup2 1 2) - (sleep 1) ;give seatd/logind some time to start up - (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid)) - (execl #$sway #$sway "-d" "-c" #$config))))) - -(define (make-greetd-default-session-command config-or-command) - (cond ((greetd-agreety-session? config-or-command) - (cond ((greetd-agreety-xdg-env? config-or-command) - (make-greetd-agreety-session-command - config-or-command - (greetd-agreety-tty-xdg-session-command config-or-command))) - (#t - (make-greetd-agreety-session-command - config-or-command - (greetd-agreety-tty-session-command config-or-command))))) - ((greetd-wlgreet-sway-session? config-or-command) - (greetd-wlgreet-sway-session-command config-or-command)) - (#t config-or-command))) + (lower-object + (program-file "wlgreet-sway-session-command" + #~(let* ((log-file (open-output-file + (string-append "/tmp/sway-greeter." + (number->string (getpid)) + ".log"))) + (username (getenv "USER")) + (useruid (number->string (passwd:uid (getpwuid username))))) + ;; redirect stdout/err to log-file + (dup2 (fileno log-file) 1) + (dup2 1 2) + (sleep 1) ;give seatd/logind some time to start up + (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid)) + (execl #$sway #$sway "-d" "-c" #$config)))))) (define-record-type* greetd-terminal-configuration make-greetd-terminal-configuration @@ -3035,8 +3031,7 @@ (define-record-type* (terminal-switch greetd-terminal-switch (default #f)) (default-session-user greetd-default-session-user (default "greeter")) (default-session-command greetd-default-session-command - (default (greetd-agreety-session)) - (sanitize make-greetd-default-session-command))) + (default (greetd-agreety-session)))) (define (default-config-file-name config) (string-join (list "config-" (greetd-terminal-vt config) ".toml") "")) -- 2.38.0