From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id GNd3L6gNrGWDGQAAe85BDQ:P1 (envelope-from ) for ; Sat, 20 Jan 2024 19:15:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id GNd3L6gNrGWDGQAAe85BDQ (envelope-from ) for ; Sat, 20 Jan 2024 19:15:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=btoH6TT0; 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=1705774504; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=HuZ2fh3uT8r520aCWVirljZpqgUoD3em/ZiaH9eMnLg=; b=udL038xs3uTzvYQrOFnuoYI5vHf0vraWc+K+NeoeelQkRmk/nMVlG4u1tewkTA5NMFkgFx 4TR5mR8EyfJUIaCe0wFXPg9E039U6EMA9xpOvfp0JFvZfmM1vCnH9Qsq04XRNCXPw4TzyU H6+gHL2UVwoQI7+rhgSf5kKNNKhKBd2RJ3I8cAaeKLcivJfduQySddqph1Y4PoXjW4IbWY BUvEvzQAtau2dGiOc8x1hJVcpG0g3XdD7azfS4DAEF1B82j/ypcSTTr7WG0sgUk3oN+ipl ImtwKL4V4FrTGUfuzC26RWin9XFiURaWYxn9NUoCxdvsgvEXJyNkAMq+gLhLaA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=btoH6TT0; 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=1705774504; a=rsa-sha256; cv=none; b=ON+UHkKjLim8B9m4c9qglIHWbk8GORIXQcosvivm2/5TYFAvfbeAMc6IpBvvldqimapLDi JffpggbPF0sDYo3j9I1PrY0R9fNfQlTbVPA311ou4DJ7f7Zkb2HBYOqCWn4yYwKE8bffie CPcjn+OkG8py0xJ5iad3+f9qWJVOmfMUVMgTjpFpVm0baKKHYzFqUrSSeE54XfDzWezzrL g5Wvn9lsCxoRTu62YgdiwIMXRt0pxxvMc2eFNwdrbtZMSVO11AMBuSZNIYAD3DJbNLYmtX pBQcfQHmxJ/EoNsNym6SuwpgUgymQSMnYf1oDP/j8CiIuJ6jx82tKogvCa1MGw== 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 B1B9E5BAC2 for ; Sat, 20 Jan 2024 19:15:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRFrc-0002aU-Ik; Sat, 20 Jan 2024 13:14:40 -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 1rRFrb-0002ZZ-8O for help-guix@gnu.org; Sat, 20 Jan 2024 13:14:39 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRFrY-0003HD-Vm for help-guix@gnu.org; Sat, 20 Jan 2024 13:14:39 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 09708240028 for ; Sat, 20 Jan 2024 19:14:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705774471; bh=PuI1cQz8W3GJEiBVdCPnqUOyorCysWMbj8tE2HZfwMA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=btoH6TT09s2EmgTCtsNnz8Ylhol8Z/GxwcmYopO7vjRom0QeKmeDExRgPT4DnenBB TrK0K2QPFXvP0pT3EiiH8a48IQSjOi8jgEw3Dyv32J9Rx45+Oh1uRmIHPECWFZNJ0J uf9aCeYIFi1zF+ITcXNJhJXFsiBpiHQy7JOGKnHo3J+gg74ro1YI5sZCymd+Zow4zr +xr7TtjaHZco+o5UfilTWx66+E/6e2RRME5boIVq3OMNOmMNR8uvkFg24Lunx+diRN yHZ1wHb6cqX5nZK1iNZ7QRU9T+coE67wnIL5Hbi1PLkTPmuaEyP3I/6v9qdAPzckxh /G2QTSJkY3/bg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4THPlB3Y7tz6tw4; Sat, 20 Jan 2024 19:14:30 +0100 (CET) References: <87jzrdtao6.fsf@posteo.net> <87h6j90zrf.fsf@posteo.net> <877ck5djur.fsf@freakingpenguin.com> <87frysi3fz.fsf@posteo.net> From: =?utf-8?Q?Th=C3=A9o?= Tyburn To: Tomas Volf <~@wolfsden.cz> Cc: Richard Sent , help-guix@gnu.org Subject: Re: Make a simple guile script to a package - source local file Date: Sat, 20 Jan 2024 18:05:19 +0000 In-reply-to: Message-ID: <87cytvj2ii.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.65; envelope-from=theo.tyburn@posteo.net; helo=mout01.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -10.39 X-Migadu-Queue-Id: B1B9E5BAC2 X-Spam-Score: -10.39 X-Migadu-Scanner: mx11.migadu.com X-TUID: sVAJV+UaMYT0 Tomas Volf <~@wolfsden.cz> writes: > [[PGP Signed Part:Undecided]] > On 2024-01-20 12:32:08 +0000, Th=C3=A9o Tyburn wrote: >> Richard Sent writes: >>=20 >> > Depending on what you mean by polluting or re-entering the profile >> > information all the time this might not be what you want. When I write >> > scripts that rely on specific dependencies I don't want to permanently >> > install, I write the shebang like this: >> > >> > --8<---------------cut here---------------start------------->8--- >> > #!/usr/bin/env -S guix shell ruby ruby-colorize password-store -- ruby >> > --8<---------------cut here---------------end--------------->8--- >>=20 >> This is a really nice trick ! >>=20 >> Unfortunately you either have to reevaluate the profile at each >> run or create a profile and do something like >>=20 >> #!/usr/bin/env -S guix shell -p >> ${GUIX_EXTRA_PROFILES}/python-pydbus/python-pydbus -- python3 > > It is work nothing that guix shell does cache the profiles, so it is pret= ty > fast: > > $ time -p guix shell vim -- true > The following derivation will be built: > /gnu/store/4mlf31h32244xzcni9w43f95k8n8xf1h-profile.drv >=20=20=20=20=20 > applying 3 grafts for tcsh-6.24.01 ... > applying 7 grafts for vim-9.0.2001 ... > building CA certificate bundle... > listing Emacs sub-directories... > building fonts directory... > building directory of Info manuals... > building profile with 1 package... > real 2.28 > user 1.24 > sys 0.09 > $ time -p guix shell vim -- true > real 0.11 > user 0.14 > sys 0.01 > $ time -p guix shell vim -- true > real 0.11 > user 0.13 > sys 0.02 Sure it is faster on the second run. Although it is even faster to activate a profile. At least for me. Maybe this is getting slowed down because I have some personal guile in $GUILE_LOAD_PATH ? I get something like this even after having run the command already: $ time -p guix shell vim -- true real 1.52 user 2.06 sys 0.15 >> > This relies on /usr/bin/env supporting -S, which to my understanding >> > isn't POSIX but instead a coreutils extension. Pretty sure --container >> > would work here but I've not tried it. >>=20 >> Also as you mentioned, I fear I will not be able to directly >> distribute this to people not running guix. >>=20 >> But thanks for the hint :) > > I am using (for guile scripts) something like: > > #!/bin/sh > exec guix shell ... -- guile -e main -s "$0" "$@" > > So if the language allows you to treat the first non-shebang line as a sh= ell > script, you can suddenly get by with POSIX env (which is handy on alpine = linux). Interesting. Also good to know, thanks