* What else could set the GUIX_PROFILE variable?
@ 2024-06-22 6:33 Adam McCartney via
2024-06-22 7:50 ` Nils Landt
0 siblings, 1 reply; 3+ messages in thread
From: Adam McCartney via @ 2024-06-22 6:33 UTC (permalink / raw)
To: help-guix
Hi Guix,
Does something set the GUIX_PROFILE variable to $HOME/.guix-home/profile by
deafault?
So I've been scratching my head about this today. It may be obvious to someone
else what is happening. I'm running guix ad a foreign distro on a number of
machines, others are guix system on one. Some use a profile that exists in
'~/.guix-home/profile' others rely on '.guix-extra-profiles/$(hostname)/$(hostname)'.
I can observe the following behaviour on a "foreign distro" that uses a profile
defined by the hostname of the system.
I define a small function in my bashrc that checks to see what one is active.
```
# .bashrc
function guix_activate_profile() {
# Check for a "host" profile
# Set it if it exists
if [ -d "$HOME/.guix-extra-profiles/$(hostname)/$(hostname)" ]; then
export GUIX_PROFILE="$HOME/.guix-extra-profiles/$(hostname)/$(hostname)"
. "$GUIX_PROFILE/etc/profile"
elif [ -d "$HOME/.guix-home/profile" ]; then
echo "default to ~/.guix-home/profile"
export GUIX_PROFILE="$HOME/.guix-home/profile"
. "$GUIX_PROFILE/etc/profile"
fi
}
if [ -z ${GUIX_PROFILE} ]; then # none active
guix_activate_profile # try to activate host profile
fi
```
After I login and start a terminal emulator, everything appears to be
hunky dory:
```
amccartn@mc ~
> echo $GUIX_PROFILE
/home/amccartn/.guix-extra-profiles/mc/mc
```
As soon as I start a tmux session, something mysteriously sets the GUIX_PROFILE
to $HOME/.guix-home/profile. And the original control loop in my bashrc doesn't run.
```
> echo $GUIX_PROFILE
/home/amccartn/.guix-home/profile
amccartn@mc ~
> guix package --list-profiles
/home/amccartn/.guix-extra-profiles/mc/mc
/home/amccartn/.config/guix/current
/home/amccartn/.guix-profile
```
Note that the guix home profile doesn't exist on the machine!
```
amccartn@mc ~
> ls -l $HOME/.guix-home/profile
ls: cannot access '/home/amccartn/.guix-home/profile': No such file or directory
```
I realize that the problem goes away if I remove the control block. So maybe
it's just a logic error on my part. I'd still like to know what is setting the
GUIX_PROFILE to $HOME/.guix-home/profile when I launch tmux.
Thanks!
Adam
--
Adam McCartney - https://admccartney.mur.at
/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What else could set the GUIX_PROFILE variable?
2024-06-22 6:33 What else could set the GUIX_PROFILE variable? Adam McCartney via
@ 2024-06-22 7:50 ` Nils Landt
2024-06-22 9:24 ` Adam McCartney via
0 siblings, 1 reply; 3+ messages in thread
From: Nils Landt @ 2024-06-22 7:50 UTC (permalink / raw)
To: Adam McCartney, Adam McCartney via
> Adam McCartney via <help-guix@gnu.org> hat am 22.06.2024 08:33 CEST geschrieben:
>
>
> Hi Guix,
>
> Does something set the GUIX_PROFILE variable to $HOME/.guix-home/profile by
> deafault?
>
> So I've been scratching my head about this today. It may be obvious to someone
> else what is happening. I'm running guix ad a foreign distro on a number of
> machines, others are guix system on one. Some use a profile that exists in
> '~/.guix-home/profile' others rely on '.guix-extra-profiles/$(hostname)/$(hostname)'.
>
> I realize that the problem goes away if I remove the control block. So maybe
> it's just a logic error on my part. I'd still like to know what is setting the
> GUIX_PROFILE to $HOME/.guix-home/profile when I launch tmux.
The installer adds /etc/profile.d/zzz-guix.sh which, among other things, sets GUIX_PROFILE.
But I don't know why this happens with tmux and not your regular shell session.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What else could set the GUIX_PROFILE variable?
2024-06-22 7:50 ` Nils Landt
@ 2024-06-22 9:24 ` Adam McCartney via
0 siblings, 0 replies; 3+ messages in thread
From: Adam McCartney via @ 2024-06-22 9:24 UTC (permalink / raw)
To: Nils Landt; +Cc: Adam McCartney via
On 2024-06-22, Nils Landt wrote:
>
>> I realize that the problem goes away if I remove the control block. So maybe
>> it's just a logic error on my part. I'd still like to know what is setting the
>> GUIX_PROFILE to $HOME/.guix-home/profile when I launch tmux.
>
>The installer adds /etc/profile.d/zzz-guix.sh which, among other things, sets GUIX_PROFILE.
>
>But I don't know why this happens with tmux and not your regular shell session.
So I guess it might be due to the fact that tmux starts a login shell, so all
the profile files are sourced, where as the gnome terminal starts with an
interactive session? Possibly mixing up the terms a bit there.
Adding the following to the tmux rc file fixes it:
```
# ~/.tmux.conf
# Don't run a login shell!
set -g default-command "${SHELL}"
```
cheers,
Adam
--
Adam McCartney - https://admccartney.mur.at
/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-22 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-22 6:33 What else could set the GUIX_PROFILE variable? Adam McCartney via
2024-06-22 7:50 ` Nils Landt
2024-06-22 9:24 ` Adam McCartney via
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).