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 ms5.migadu.com with LMTPS id 2CtbAJOJL2O25QAAbAwnHQ (envelope-from ) for ; Sun, 25 Sep 2022 00:49:55 +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 OBIzAJOJL2OrAwAAauVa8A (envelope-from ) for ; Sun, 25 Sep 2022 00:49:55 +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 7932C1C961 for ; Sun, 25 Sep 2022 00:49:54 +0200 (CEST) Received: from localhost ([::1]:45568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocDy5-0005hk-4R for larch@yhetil.org; Sat, 24 Sep 2022 18:49:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocDxp-0005hO-QP for help-guix@gnu.org; Sat, 24 Sep 2022 18:49:37 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:58141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocDxj-0004Z1-OC for help-guix@gnu.org; Sat, 24 Sep 2022 18:49:37 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D379F5C00A4; Sat, 24 Sep 2022 18:49:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 24 Sep 2022 18:49:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trevdev.ca; h=cc :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1664059766; x=1664146166; bh=AdkH3XTlEu 9StgdeXmOMwdj379ITs73YuU5GEQlX1/s=; b=efkw4BsvGnuak+Zc35YprGEtNT fNcl8ECNtc/pj6aK5soLhfp5u7IxpnmQ/WxZZvxzIks4iCRiew1X5YytjrtB4euc FD2+XR9JevpJr/qNosP+uKIRx6bk7HEt/yA09zXmeTx9goLKV9BiP4lMV+BJPLa/ UL3LAEL6UzVAgkYO/BOpl5v5q/Yu3Tx4G4AJDgl7bkgH5dLfQmpkWHN3hdX29nx4 fiugfy1iOUV+vQKKMRc3CeIMhczg/InPwhQh+9Rj/DBIbTBwszaQdL7wKNfvr8Jd ka8tU727unX4LGAGBED6voMAsNA/DRzibYjhtST0tQhTKp+XVeChRi4ezrdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1664059766; x=1664146166; bh=AdkH3XTlEu9StgdeXmOMwdj379IT s73YuU5GEQlX1/s=; b=Q14s/mMJiciPERhw2ZBk6e3RCfY9/KO2Zh+B0waCuOIf ISOvQicNnmN0HuzERiCuyJgfod9rfQkWNh5Ca6Og0KjzMtlZEf7wglsEl1zJnvp7 ucayznTrF0shhtzTWa16B1MXrNteGOCWSeP8GscMh1C29YVwDEsN+x2+Rfp3KWsU YGGcudd/RZDPgQ1PQSr3yksXQdgVtGHo2w5Kel3IdbgY1fTA1rAYVI8V4E5K9DkD 0bSmno7Pji7LRV/6hmCk3+VpsQczPm9n7Kdvfghl5GcFqoauacn9nnLebwXx6Vhn xNKrgdwKjSFqYnyFNZc+7gcIHf3tN7ShUObVSDIL7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefledguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffujghffgffkfggtgesghdtre ertdertdenucfhrhhomhepvfhrvghvuceothhrvghvsehtrhgvvhguvghvrdgtrgeqnecu ggftrfgrthhtvghrnhepjeffueethedtteekieejtdeijeevgeeikedviedtveehieffge dtvdelhffhhefgnecuffhomhgrihhnpegtohhnfhhighdrlhhotggrlhdphhgvlhhlohdr shhhpdhgnhhurdhorhhgpdhhohhmvgdrlhhotggrlhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehtrhgvvhesthhrvghvuggvvhdrtggr X-ME-Proxy: Feedback-ID: i762946f9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 24 Sep 2022 18:49:26 -0400 (EDT) From: Trev To: Fabio Natali , help-guix@gnu.org Subject: Re: Guix Home, .local/bin executable scripts In-Reply-To: <87r100czb9.fsf@reckondigital.com> References: <87r100czb9.fsf@reckondigital.com> User-Agent: Notmuch/0.36 (https://notmuchmail.org) Emacs/28.1 (x86_64-pc-linux-gnu) Date: Sat, 24 Sep 2022 15:49:21 -0700 Message-ID: <874jww2xse.fsf@codinator.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=66.111.4.29; envelope-from=trev@trevdev.ca; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_PASS=-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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664059794; 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=AdkH3XTlEu9StgdeXmOMwdj379ITs73YuU5GEQlX1/s=; b=rQlAh/mSR1M97Kj1R+PX002YpjeBDyuQdF3wWCwHtrH53rEpDgc8GojmRKM43j1dhJ9N09 /+8MzRaaZoJOesSWPETMwIkjPA1RmIPAPi3fqM7EUg8ZgWfhfkZRwVRFUuNRCyvMfNmfNi h7rjVXfMTYup+9mSHQwPS+IBjy1TQ3jXwQ4SQ4hz3EBX367P+oDO6MuWawyFfGcUnMG++A Jj3tnX+Iwqd8lzBxu+pFeH6ZaVzZEdLzpALlfivZgk6X2yudufQCwPZsV1S/8+VXd+N3XL R45JyhUAXM6Eg61W2EUYQVDJBJ164XoAhWlIutp8sLGkwcJLLT7Buuzh88Ta0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664059794; a=rsa-sha256; cv=none; b=dsgT0cOnmco99TSEldOBfzBRg7p7CnMpNUXwEaHMvY5armcnvoYTf7O3QbQTzfZqDkT5vx HUBraBKxEyF5hW6RycYUPckdfZyNEIAJ1GUehHArdd9DOPH+jagC6GOtR6E18O3+F7a9x4 b+xNHWtlbUxSBWlb1Vf/J2YvSfJ7zX2hQdDJGrunpcCrC0HTWvwuLij853hGre5OZY0duY OqXe2kkyz20sjxvT20lYuQj+rdv9uAdluAskYYEeyEwged5W3rYc/OHYvC0vdN6QL9c0AH 7VAAoTTztAqP09jz73HGuBQkr1bY92hjAvMiTWR0/5aOb0xR0t2mqKT6JW0a0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trevdev.ca header.s=fm3 header.b=efkw4Bsv; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="Q14s/mMJ"; dmarc=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-Migadu-Spam-Score: 1.15 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trevdev.ca header.s=fm3 header.b=efkw4Bsv; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="Q14s/mMJ"; dmarc=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-Migadu-Queue-Id: 7932C1C961 X-Spam-Score: 1.15 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7xuy5smhpGmq --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Dear All, > > I've recently started exploring Guix Home. I was able to create a few > simple services for some of my apps, e.g. Emacs. > > I've now come to a point where I'd like to add some executables to my > configuration, e.g. some of my `.local/bin' scripts. > > Consider this `hello.sh' script, for example: > > ,---- > | #!/bin/bash > |=20 > | echo "Hello World" | sed "s/World/Guix/" > `---- > > The following service copies `hello.sh' to the expected destination and > does so while preserving the correct permissions (`#:recursive #t'), > i.e. the file is executable. > If the thing is being moved to your store for any reason you may want to explicitly update the permissions. I had to do this when I packaged PHP composer for personal use. Things tend to go into the store as read-only. > ,---- > | (define my/home-hello-service > | (service > | (service-type > | (name 'home-hello) > | (extensions > | (list > | (service-extension > | home-files-service-type > | (lambda (config) > | `((".local/bin/hello.sh" > | ,(local-file "scripts/hello.sh" #:recursive? #t))))))) > | (default-value #f) > | (description "My valuable Hello World script.")))) > `---- > > The script shows up in my Guix Home but it won't work - I suppose that > `/bin/bash' should be replaced with the correct Bash store path? > I would try to us a portable shebang such as #!/usr/bin/env bash. You may also use a gexp to dynamically insert the true location of your profile's bash path. This is the guix way, so far as I can tell. I am not sure what the use of a #:recursive? keyword might be in the context of a single script. Check out the manual on Gexps. I find it to be pretty helpful. > ,---- > | ~$ hello.sh > | -bash: ~/.local/bin/hello.sh: /bin/bash: bad interpreter: No such file = or directory > `---- > > I've been looking at the docs and found something that feels related to > my problem (e.g. `computed-file', `substitute*', ...?) but I'd > appreciate if someone could point me in the right direction. > You can patch a shebang or anything else with substitute by doing the following from within a gexp where #$bash happens to be the bash package reference so long as it is in the right lexical scope. See (with-imported-modules) in the manual. (substitute* "scripts/hello.sh" ("#!/bin/bash" (string-append #$bash "/bin/bash"))) Link to manual: https://guix.gnu.org/manual/en/html_node/G_002dExpressions.= html > Thanks, best, Fabio. > Good luck. Full disclosure: I'm only just starting to get the hang of this stuff. Anyone else is welcome with better advice. =2D-=20 Trev : 0FB7 D06B 4A2A F07E AD5B 1169 183B 6306 8AA1 D206 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIYEARYIAC4WIQTXT7EGCbVt/Iwh9m+FRs+EoT3V7wUCYy+JdBAcdHJldkB0cmV2 ZGV2LmNhAAoJEIVGz4ShPdXvV3ABAKt04YdjiVFRctI+M2mNfpDdf2tV6l+LQAkI +xAgdKdfAP9LVsbkvMx5O2gVGo+sx455vhcYzh0GXR/6ZnYU11XpCA== =aTia -----END PGP SIGNATURE----- --=-=-=--