From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4LM6BENcU2TQxQAASxT56A (envelope-from ) for ; Thu, 04 May 2023 09:18:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GEwuBENcU2QxMgEAauVa8A (envelope-from ) for ; Thu, 04 May 2023 09:18:27 +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 AAB2C397F6 for ; Thu, 4 May 2023 09:18:26 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puStZ-0007Wd-R0; Thu, 04 May 2023 02:56:54 -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 1puStD-0007RD-3o for help-guix@gnu.org; Thu, 04 May 2023 02:56:32 -0400 Received: from r0-2.smtpout1.paris1.alwaysdata.com ([2a00:b6e0:1:40:1:0:10:6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puStA-00050z-4S for help-guix@gnu.org; Thu, 04 May 2023 02:56:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alwaysdata.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2W0sFIJ8z+/G+2Y1cBNtwkYQQTrkiIykxMYENp0ATRA=; b=eyr3So/NynGnErrvlMfd/moeK wFyf5gkoGAw5p6YJ4w2aJw8bM1M+XTb2I9leCzs8gmt58ymWIFSVBhg5AlI93h0SeKDAYQrOMap87 sh1qw4xH7CoBOYXLqlZU5R8ljlfCdnYN/q8ub4ZbSuQJhP+/WHZ+4mSr5DJswApmf+n5I=; Received: from node-1w7jr9pqliri9tslsf7amsrmv.ipv6.telus.net ([2001:569:5856:9800:9b7b:9a49:2ca1:e8e7] helo=localhost) by smtpout1.paris1.alwaysdata.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1puSt2-0007OZ-OY; Thu, 04 May 2023 08:56:21 +0200 From: Tom Willemse To: Mario Forzanini , help-guix Subject: Re: Home service that serializes into an executable file In-Reply-To: <875yaktx6j.fsf@marioforzanini.com> References: <875yaktx6j.fsf@marioforzanini.com> Date: Wed, 03 May 2023 23:56:17 -0700 Message-ID: <875y98y48e.fsf@ryuslash.org> MIME-Version: 1.0 Content-Type: text/plain X-alwaysdata-ID: 203235296 Received-SPF: pass client-ip=2a00:b6e0:1:40:1:0:10:6; envelope-from=tom@ryuslash.org; helo=r0-2.smtpout1.paris1.alwaysdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683184706; a=rsa-sha256; cv=none; b=df2kqPbVbnmFLUmnNSnwXFxIyYOs3W5V67gi+pGapEj8mB3q7CEQw6pCIda9c3fX4Jhke/ QzwdixI2nNJ6Iu3hKHPLWqFAMEo05uRkOwctOB7gByYEsUPHtm9F8q23nffQ47OoqowTSM jQleFwEnpGeLrpv22xZm+b4ugFianemGBSgLhmKUN+2yPgG/fudrnIXd0EmNhIh+yTWnKa WWa3ZiTPMDegtoLE1qKHjMflPuKVkJ55iNhyFmVXdwCPfMmbWfknoglv1c/B13BbhCjmvi OwKjsba09dqW4YJ2eH0tlmgb4pYBQDrpGd7ae4UD95n6h9LI2nzeGZJXkzsOJg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=alwaysdata.net header.s=default header.b="eyr3So/N"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=ryuslash.org (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683184706; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2W0sFIJ8z+/G+2Y1cBNtwkYQQTrkiIykxMYENp0ATRA=; b=PRehuE3zcenkGMMilFr/TEPiPZEYu4DnKpYMSXbyWjCLwNIl58hHELdKXeRn+JWhFrG4/+ ejpQWaniwmgrGVD3YXUpAjyAlXzNFAxd+eAse6/v+QD2sHYxkbimP2mecNEH9vyyfD6lH9 MbqLUov05c/zB+AXA6ef/NSFqedmO4PGOggLHJ7lp2vVpwCvGJntJvmtqW9nHZis1r0bR0 HjMCiwUZav8vIFy10ojBiFveeVrarRYYMltvmf8tbssthEhrOHu7Kyr6WvgW92YFBFgO3T 1fKybijcffmvTyuqsDJbUz+3fycj5uwwcmQGLhZPtTyYWA3cX9QDKS2jMdRD4w== X-Migadu-Spam-Score: 1.19 X-Spam-Score: 1.19 X-Migadu-Queue-Id: AAB2C397F6 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=alwaysdata.net header.s=default header.b="eyr3So/N"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=ryuslash.org (policy=none); 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" X-TUID: fb6bSjT4ab5o Hey Mario! Mario Forzanini writes: > Hello everyone! > > I've recently tried to write a simple home service that serializes into > an ~/.xsession file. As someone pointed out in an older message on this > list, this file has to be executable; I used to achieve this including > an external file like: (local-file "xsession" #recursive? #t). Is there > a procedure that allows changing permission bits while generating a file > in the store? > > This is still in a rough state, but here is the definition of the > service: That looks nice :) much more interesting than my xsession home service, which just joins a few strings together into an .xsession file. I ran into this issue as well, and what I ended up doing was copying (I think it was) mixed-text-file and modifying it for my own configuration. I have: (define* (mixed-executable-file name #:key guile #:rest text) "Return an object representing store file NAME containing TEXT and having the executable bit set. TEXT is a sequence of strings and file-like objects, as in: (mixed-executable-file \"profile\" \"export PATH=\" coreutils \"/bin:\" grep \"/bin\")" (define build (let ((text (if guile (drop text 2) text))) (gexp (call-with-output-file (ungexp output "out") (lambda (port) (set-port-encoding! port "UTF-8") (display (string-append (ungexp-splicing text)) port) (chmod port #o555)))))) (computed-file name build #:guile guile)) Which really should be just like `mixed-text-file' except the call to `chmod' has been added. And then I would use it just to replace the `mixed-text-file'. > > (define (xsession-file config) > (define dot-xsession > (mixed-executable-file "xsession" > "#!/bin/sh > try() { > pgrep -q $1 || $@ 2>> " > (xsession-serialize-field config 'log-file) > "\n}\n" > (xsession-serialize-field config 'programs) > (xsession-serialize-field config 'window-manager))) > `((".xsession" ,dot-xsession))) > I don't know if this is the best solution, but this worked for me. Hopefully this helps! Cheers, Tom