GNU bug report logs - #77878
[PATCH] pre-inst-env: Issue a warning if nor run within a guix shell.

Previous Next

Package: guix-patches;

Reported by: nomike <nomike <at> nomike.com>

Date: Thu, 17 Apr 2025 21:38:03 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77878 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77878; Package guix-patches. (Thu, 17 Apr 2025 21:38:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to nomike <nomike <at> nomike.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 17 Apr 2025 21:38:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: nomike <nomike <at> nomike.com>
To: guix-patches <at> gnu.org
Cc: nomike <nomike <at> nomike.com>
Subject: [PATCH] pre-inst-env: Issue a warning if nor run within a guix shell.
Date: Thu, 17 Apr 2025 23:36:29 +0200
Change-Id: I9f212b3c665b7d8ac653c44eeafe6fc41da5b8ff
---
When running ./pre-inst-env on a foreign distro not within a guix shell, weird things happen.

```plaintext
$ ./pre-inst-env guix lint nano
guix: lint: command not found
hint: Did you mean `lint'?

Try `guix --help' for more information.
```

This patch changes pre-inst-env to issue a warning in that case, which could be especially helpful for newbies.
Perhaps a pointer to the right place in the documentation would be helpful here as well.

 build-aux/pre-inst-env.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in
index cd90a06cbc..6081d7aaa5 100644
--- a/build-aux/pre-inst-env.in
+++ b/build-aux/pre-inst-env.in
@@ -24,6 +24,11 @@
 # Run COMMAND in a pre-installation environment.  Typical use is
 # "./pre-inst-env guix build hello".
 
+# Check whether we currently are in a guix shell and issue a warning if we're not
+if [ -z "$GUIX_ENVIRONMENT" ]; then
+    echo "\e[1mWarning:\e[0m you are not in a guix shell. This may lead to unexpected results." >&2
+fi
+
 # By default we may end up with absolute directory names that contain '..',
 # which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
 # recorded by Guile.  To avoid that, make sure we get a real absolute
-- 
2.49.0





This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.