From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 mGkpJR9Sc2JnkAAAbAwnHQ (envelope-from ) for ; Thu, 05 May 2022 06:27:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ODR5JB9Sc2J2LwEAG6o9tA (envelope-from ) for ; Thu, 05 May 2022 06:27:11 +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 2DCE519F1A for ; Thu, 5 May 2022 06:27:11 +0200 (CEST) Received: from localhost ([::1]:36700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmT54-0006IU-B1 for larch@yhetil.org; Thu, 05 May 2022 00:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmPzy-0006n3-6w for help-guix@gnu.org; Wed, 04 May 2022 21:09:42 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:34653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmPzw-0005to-EK for help-guix@gnu.org; Wed, 04 May 2022 21:09:41 -0400 Received: by mail-pj1-x1033.google.com with SMTP id qe3-20020a17090b4f8300b001dc24e4da73so4669057pjb.1 for ; Wed, 04 May 2022 18:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devnulllabs-io.20210112.gappssmtp.com; s=20210112; h=user-agent:from:to:subject:date:message-id:mime-version; bh=h1Mb38dCzyKXJexMv3RDP8hk5KlftQSLINXv7DiqT8s=; b=dr6OI6rLb45dxahZasFMT+2jye7qE/T7+V1jRfjuHKUzX3vUKRBSQQsGfFfM1ymFVU FFh+5+urFDJgKatzM/TrxRBtj8RmtwptNl8CdT8wnvWefSqumVhAcwxdOrJbN9qvvp7c OpC77mS42mXMv0mC3gsHrGjDgxqGlAxuF8NthkPJrcKj+XGUgyoeiRB0mrstrKHTumOX 5e7KuCSUatTE/bEM8nqThFM0R5I4iEXHSpqwbVrQzx/v6/oq6lQfpmkY0fD3AOXwTatO 56s4xdQjyc3/QNloJjiDqB5F88YglWkfBwzJ+GmY/kK3FmTXk96qD3v5+8H90V1vgLAr 2NKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=h1Mb38dCzyKXJexMv3RDP8hk5KlftQSLINXv7DiqT8s=; b=xTdmJFoofF56xqdq+geclMi8Jaj6rRUCqI1zv1Qz/9MoQQicSo8D8jbxcDubXKzlrd aWGMJKFHzo+3zZYQyUdMhD+tSOPpOKZ7W3ofQyp23CHzIGm0X16UpN0JnNOnmOSm8yGj 2nhFKN+pT9cUgusTLUCtil2YFq2J9Upv7Y+rgSOX9RcOPTERtznfnwXfo7teUtQ/wm3d sd+sIEJBlLw6ZwC54cYfZSkdVZkiDLQgjLxkCmwxhKr+PMWil6/IjmvER7+NQsOS1h3a F0T/Qi2GHrAhNee7he+eaE13xx6vGHwasauv2WCb1gWLjN8oAvdUvyosXCv4Fq8MWCiW ElyA== X-Gm-Message-State: AOAM532nA/uMT3Zsxbw5LUzKg+IulwdC52LYJS1Rw8r4Kz+fBdQaO99Z JYQojiwENwM1A5ob5Yy4gpjcAS4OzXlrdQ== X-Google-Smtp-Source: ABdhPJy+sK8HEYNOUHwCE+Ye7BOkev3jhdTAevd5RtA5QPZ+FAvIfBnAxKDcrCRRO1UiibqQHuSM5w== X-Received: by 2002:a17:90a:b78d:b0:1d9:4f4f:bc2a with SMTP id m13-20020a17090ab78d00b001d94f4fbc2amr2877671pjr.155.1651712977932; Wed, 04 May 2022 18:09:37 -0700 (PDT) Received: from localhost (174-126-238-143.cpe.sparklight.net. [174.126.238.143]) by smtp.gmail.com with ESMTPSA id ca26-20020a056a00419a00b0050dc76281a4sm20412pfb.126.2022.05.04.18.09.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 18:09:37 -0700 (PDT) User-agent: mu4e 1.6.10; emacs 28.1.50 From: Kenny Ballou To: help-guix@gnu.org Subject: set environment variables with guix shell [-m manifest.scm] Date: Wed, 04 May 2022 18:53:47 -0600 X-PGP-Key: https://kennyballou.com/932F3E8E1C0F4A9895D7B8B8B0CAA28A02958308.txt Message-ID: <87tua4kcoh.fsf@devnulllabs.io> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=kb@devnulllabs.io; helo=mail-pj1-x1033.google.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, RCVD_IN_DNSWL_NONE=-0.0001, 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-Mailman-Approved-At: Thu, 05 May 2022 00:26:51 -0400 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=1651724831; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=h1Mb38dCzyKXJexMv3RDP8hk5KlftQSLINXv7DiqT8s=; b=bDDPQGB+R0bPD6eNy7nsABf0i46ksNkpfgnkUCiL7SAAFFRD/rp8vLCk8gjf9JNA34PD4P S76B6VjJYkcjVnQt89ygJEUxRPTsfU8vBuGTlPf9xJ9lcWe1g5/7JP27nW/dWldCJ/yn1/ JtQudFr8O6E6V4kh5pH5AvH+JTC7hy/TtJhvF6aVNjDPT508CpaU+xdHVtCTT+w+ZUsKiq sTpo6UYnA2vm9tvF2U2ncNuhGyX7v+7DDNaa4bSSr8BTMuYnSdcnQ4ZpZRPoP7RqruqGgf Y3bzIoytNfdrn2ecagMnQmvoXgc3d+XVKQ2W0G3B6mPLWeUGDvyrZipS5mv4vQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651724831; a=rsa-sha256; cv=none; b=Lzu5a/FKbv842VKfBpbB0d4Z/EKVt04smPO+j7PLQAz6Lizih7CQ4CpBXpvqwHibI8jeZl dGdr6AK9h5ODpncUz1jqSF7wowlNwMrYhkWt7QsKPvVUvD+qpeNJj341lvHT7CSzWyO2oM 4X5rteO1gq1oFSua9VIQdbHUwG1OMXlDWMwtX1TOmOm1/bW1wdRdZONQLIUfzPddroNBv9 ka0WoYttLcm+CQri7Bj/wwsTjgfM+mBgkRt4liUf/7qB1RqXQ12EjUotUxtv4m12LZ35s/ Z/yQyHGu1Qofxr8l20951CKAP12P7iPwQ6q0d19WBDf6Cm7EkgTW5YBaJxo66w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=devnulllabs-io.20210112.gappssmtp.com header.s=20210112 header.b=dr6OI6rL; 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: -8.79 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=devnulllabs-io.20210112.gappssmtp.com header.s=20210112 header.b=dr6OI6rL; 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: 2DCE519F1A X-Spam-Score: -8.79 X-Migadu-Scanner: scn0.migadu.com X-TUID: InG7R/C8EO+n Dear list, I have been using nix-shell for a while now to have on-demand/ad-hoc development environments for different projects. These are hooked in with direnv and the whole experience is quite nice. However, I would like to translate these to Guix because I find the tooling around Guix and Scheme far better and easier. However, one necessary feature of `guix shell` I'm not seeing: ability to set arbitrary environment variables when `guix shell` loads. Certainly, I thought I could just add some `(setenv "FOO" "bar")` in the `manifest.scm` file. But if the environment is reloaded, these statements do not seem to persist. For example, I've been working on a manifest for my current main project, it has the following, elided for brevity, contents: ``` (define z3-with-java (package (inherit z3) ...)) (let ((z3-dir (run-with-store (open-connection) (package-file z3-with-java)))) (setenv "LD_LIBRARY_PATH" (string-append z3-dir "/lib")) (setenv "Z3_DIR" z3-dir)) (packages->manifest (list openjdk11 ... z3-with-java)) ``` Perhaps, this is not the right way to do this? Is there a different mechanism I am not aware of? Would this be a good extension to `guix shell` manifests? This would not be an issue if I did not need the store path of the package. I could simply set the environment variables in the `.envrc` file. However, I still think it would be preferable to have a mechanism for setting environment variables via `guix shell` similar to `nix shell`. Thoughts? My gratitude in advance. -Kenny -- :SIG:!0xB0CAA28A02958308!: